Erase/delete lines from a plot

I have a software that draws, sequentially, Bezier curves, in a graph, as the coordinates of the vertices are modified
I need that before drawing a new line, the last line drawn is erased, before drawing the next one.
Attached a part of the code.
plt.plot(*yy.T, color=‘r’)
What will be the solution?

Did you have a look at Animated line plot — Matplotlib 3.6.3 documentation