JMP will create for you most of the script that you need to do what you are wanting to do; In the example below, I am using the Semiconductor Capability data table from the Sample data tables provided under the Help pull down menu
First you just need to run the Tabulate platform, setting it up the way you want it:

Then under the red triangle, select Make into Data Table

Most of the script that you will need, is contained in the Source code for that created the table. To get to it, click on the red triangle next to the "Source" entry in the Tables Panel at the left of the table:

Select Edit and the script that produced the table is displayed

Cut and paste this into a JMP Script window (File==>New==>Script), and add the statement to save the new table
(Data Table( "Semiconductor Capability" ) << Tabulate(
Add Table(
Column Table( Analysis Columns( :NPN1, :PNP1, :PNP2, :NPN2, :PNP3, :IVP1 ) ),
Row Table( Grouping Columns( :lot_id ) )
)
)) << Make Into Data Table;
// Note the ";" added to the end of the above line
// Add the statement to save the data table as a .csv file
current data table() << Save As("C:\The Example.csv");
Jim