Clearing Screen to Reflect New Drawing

i draw a line on screen then in next iteration of loop, i want to draw NEW line on previous-lines position. How to do it?


Basic pseudocode :

draw line from a to b
b = a
a = new position
goto start

What is the problem ?