I am trying to loop through 22 .txt files in a directory, read each lines from the file, and apply some conditions, before writing the modified lines in a newly created file