Action set start X, set start Y to one of your sprite hotspot.
Set end X, set end Y to the other.
Each frame, move your objects and set the values of the line again.
And if you still need the distance between the sprites you can get it using the system/math expression "Distance between points".
(Or substracting spriteB.Y by spriteA.Y)
I hope it helps.