Write the results to a file instead of printing to console.