doing some renaming and writing line info to output file