implement writeTextFile, append Persistent Data Structure