write_report function

Write the prepared data to a txt file in key-value format