My script generates FrameIDs which are the basis of the timestamp
I created a java script that generates a timestamp, my concern is that I have to create a variable and then I do not know how to create it to have $ {myvar}?
If you need to create a date variable with millisecond format you can do it with a NeoLoad variable. At the end of the drop down list just select "milliseconds" format.
If you really want to use your Javascript you need to use that method:
context.variableManager.setValue("Myvar",timestamp);
Myvar is the variable name that you can use later on in your script with that syntax ${MyVar} and "timestamp" is the content of that variable (here it's a JS variable).