Creates and saves the output file.