The default behavior of the plot() command is to plot into the currrent axes in the current figure. Clicking a figure makes it the current figure, which is why subsequent plot commands replace what was there. To avoid this behavior, plot into specific axes (i.e., not necessarily the current axes in the current figure). Something like this might work:
ax = gca();
By specifying ax to the plot command, you are telling MATLAB to plot to that axes, rather than the current axes (similarly for the hold command). This way you can interact with previously created figures while the code is running, and they will still become the current figure, but MATLAB will plot to the new one.