I think you are asking how to use JSL to make another JSL script, something like this:
Save Text File( "$temp\deleteme.jsl", "print(42);" );
Include( "$temp\deleteme.jsl" );
Welcome. You could operate a text editor via the Menu() function, or you could do something like this (run one line at a time, watch the log window):
// make a file#1
x = Save Text File( "$temp\deleteme1.jsl", "print(42)" );
// open it; savetextfile returned the pathname to "x"
y = Open( x ); // opens an editor window
// grab the text from the editor and save it to file #2...
z = Save Text File( "$temp\deleteme2.jsl", (y[Script Box( 1 )]) << gettext );
// close the editor...
(y[Script Box( 1 )]) << closewindow;
// look in the log to verify...
Load Text File( z ); // echo the text
The menu function requires knowing what window has focus. This code requires a variable ( y ) pointing to the editor. The previous JSL-only (no editor) approach is probably easier if it works for you.