Try this:
//!
Open Log();
win = Window("Log");
Print("test");
ScriptBox = win[ScriptBox(1)];
text = ScriptBox << Get Text;
Save Text File("c:/Temp/Log.txt", text);
You can choose a different file path but c:/Temp is a generic location.
Log file should contain the script that executes and ends with "test" which we print.