I'm guessing you're not using cls.
How about...
1) cls
2) Draw background
3) Draw rect
4) loop to 1)
When the mouse is released for drawing the rectangle then make that part of the background.
How about...
1) cls
2) Draw background
3) Draw rect
4) loop to 1)
When the mouse is released for drawing the rectangle then make that part of the background.