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:
Init being found with
In the end, If I am correct,
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
Game design is all about decomposing the core of your game so it becomes simple instructions.