organized the gathered data and create output file