The file name globbing happens on the for-line, with the expansion of $(cat $myfile), not in the echo.
When looping over the contents of a file, use read:
while IFS= read -r words; do printf '%s\n' "$words" done <"$myfile" See also:
- Understanding "IFS= read -r line"Understanding "IFS= read -r line"
- Why is using a shell loop to process text considered bad practice?
- Security implications of forgetting to quote a variable in bash/POSIX shells
If you want to have each whitespace-separate word on its own line of output:
awk '{ for (i = 1; i <= NF; ++i) print $i }' "$myfile"