Change file concatenation from calling cat to python file read+write