There's an awful lot of useless use of cat in your scripts. The reason why cat is useless here also explains what you should be doing in your script instead: just use redirection. Or just leave things unchanged so other things can do redirection.
grep xy < zz > zz_solution.txt
If you insisted on putting it in a script, which seems unnecessary when it's only one line, you'd just do:
#!/bin/sh
grep xy
Without parameters, grep will read from stdin and print to stdout, and you can redirect it from the outside.