The best way to develop a script in JMP, is to have JMP provide as much as possible of the JSL. To do that, one typically executes each step interactively, requests from JMP to save the script from the step, and then go on to the next step, and continue repeating for each step in the process. Therefore, I suggest that you attempt that process in developing the script you need. Your final step to create a report output from the final data table can be as simple as
names default to here(1);
dt=current data table();
nw=new window("Journal",<<journal);
dt<<journal;
If you are running JMP 16, the new annotated log will provide the JSL for the steps you run. In earlier versions, there is an option under the various JMP platforms that will create the script that will run the step. Or, if the step ceates a data table as it's output, the "Source" entry in the Table Panel in the data table display will contain the JSL required to create the output data table.
Jim