MATLAB has some graphic primitives that always always add to the current scene, without erasing anything that is already there. These primitives include line(), patch(), image(), and a few others. (However, plot() is not one of the primitives.)
If you want to erase a graphics object created by a graphics primitive, then delete() it, or cla() to clear the axes.
Instead of creating new lines, you should consider using set() to change the position or color or other attributes of existing lines.
