I can not give you detail example because I have no ideas about your model for the simulation.

I only know you want the simulation to remember a set of data points and you want to show those data points.
So you need to define variables to save those data points. For examples: npt=100 (maximum number of points to be saved), xs[npt],ys[npt], np=0;// number of points been saved
Add the following to the press action property for button

And you can display it with polygon elements in GUI.
Set number of data to be shown as np;
x,y coordinates to xs,ys
Then EJS will take care of the rest for you!

If you can upload your ejs source files and describe in more detail what you want to do, I can try to modify your ejs code to suit your need.