changed script to write files, to make txt files with space separation and col names.