I have a sentence like
This is for example
I want to write this to a file such that each word in this sentence is written to a s
Use the fmt command
fmt
>> echo "This is for example" | fmt -w1 > textfile.txt ; cat textfile.txt This is for example
For full description of fmt and its options, check out the related man page.