Those commands should be written as:
wc XXXX.txt > YYYY.txt
sort XXXX.txt > YYYY.txt
Or if those programs weren’t able to read from files directly:
wc < XXXX.txt > YYYY.txt
sort < XXXX.txt > YYYY.txt
You can chain
cat indefinitely since all it does is repeat the same data, it’s often redundant.
When I use cat it’s to display a small file (cause cat will write the file to stdout which is going to show up in the terminal) - or to do the opposite, use cat to read from stdin (the terminal) and redirect to some file (allowing me to paste into a file)
Keep in mind that its namesake is concatenate, this repeating behaviour is just what you get when you concatenate a single file and is seldom needed for using other programs. Redundant use of cat is a pretty common mistake.