Aside from your snippet missing a quote after "echo"?

Well, I doubt echo can deal with an argument ">> test.sh" the way you assume it would.
">> filename" on a shell is interpreted by the shell and takes the output of the program and appends it to "filename".
The program itself never sees that as part of its argument list.

What do you actually want to do?

Cheers,
_