What will be in out.txt?
ls nonexistentfile | grep "No such file" > out.txt
Nothing, out.txt will be empty.
No such file
It will be the contents of nonexistentfile.
ls: cannot access nonexistentfile: No such file or directory