changed from cat to echo when writing to file