You can easily transform lines into vectors by substracting the endpoint minus the startpoint of the line.
Let’s say you have two lines with endpoints L1(X1,X2), L2(X3,X4), where:
X1 = (x1,y1) X3 = (x3,y3)
X2 = (x2,y2) X4 = (x4,y4)
So to transform the two lines into vectors, you must substract the endpoints this way:
u = (x2-x1, y2-y1)
v = (x4-x3, y4-y3)
The formula that will help you obtain the angle between these two lines is:
Ɵ = cos-1(| u·v |)/(√u12+u22 * √v12+v22)
This formula can easily be translated to n dimensions.