Well, if A.x and A.y are the coordinates for point A, and same logic for B
with let's say course being a variable between 0 and 1
you have lerp(A.X, B.X, course) returning an X value
lerp(A.Y, B.Y, course) will return the Y value on the same line corresponding to that X, as long as course is between 0 and 1, the point will be between them.
EDIT: if you prefer the actual equation of the line (AB), you can have it:
Y=(A.Y-B.Y)/(A.X-B.X)*X+ init
Init being found with
A.Y=(A.Y-B.Y)/(A.X-B.X)*A.X+ init
init= A.Y-A.X*(A.Y-B.Y)/(A.X-B.X)
In the end, If I am correct,
Y=(A.Y-B.Y)/(A.X-B.X)*X+A.Y-A.X*(A.Y-B.Y)/(A.X-B.X)
or Y= (X-A.X)*(A.Y-B.Y)/(A.X-B.X) + A.Y
Depends on what you want to do exactly after that...if it is verifying if a point C is between A and B, you just verify that A.X<C.X<B.X
and that C.Y= (C.X-A.X)*(A.Y-B.Y)/(A.X-B.X) + A.Y