Help with saving previous coordinates

I want to make it so there will be a line from the start position of the ball to the end position, It's a loop so the ball will create a pattern that the line will always follow.

I tried something like this but it doesn't work the way I imagined. global BallX is the same as the X coordinate of the ball so the line goes from (for example) 3.50 to 3.50 so there is no line. Any idea how to do it?

Try this-