add the function to write the data packet to file.