Here is a simple script that will do what you want
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Loop across all rows
For( i = 1, i <= N Rows( dt ), i++,
// Copy all columns for the given row into a list
rowVals = dt[i, 0];
// Initialize a string variable
theString = "";
// Loop across all values in the row list, and place them into the string variable
For( k = 1, k <= N Items( rowVals ), k++,
If( k > 1,
// After the first value, add a comma between the values
theString = theString || ","
);
theString = theString || char(rowVals[k]);
);
// Add a new line character at the end of the line
theString=theString||"\!n";
// Write the row's values to the output txt file
If(i==1,
save text file("$TEMP/myfile.txt",theString,mode("replace")),
save text file("$TEMP/myfile.txt",theString,mode("append"))
)
);
Jim