You could use a parametric equation for the line. Assuming the line goes from P to Q, the equation (L(t)) would look like:
L(t) = P + t * (Q - P) 0 <= t <= 1
The operations here are vector addition and scalar multiplication, so if P=(Px,Py) and Q(Qx,Qy), then the coordinates you move along are:
x(t) = Px + (Qx - Px) * t
y(t) = Py + (Qy - Py) * t
0 <= t <= 1
By changing the value of t from 0 to 1 you get all the points on the line.
shmoove