added the function to write the putput file for the experiment