Drawing and erasing lines

I nees to draw several lines, one after one.
I need, before drawn one, erasing the old one.
For exmple weahave two pointe and a line between.
With mouse one of these ponists is chandeg and I need a new line, erasing previous line.
How to do this?