You should add the shebang line at the beginning of your script.
#!/bin/csh
So that it will be executed with the `/bin/csh` and not with the `/bin/sh`.
The error looks like your script is executed with `sh`.
You should add the shebang line at the beginning of your script.
#!/bin/csh
So that it will be executed with the `/bin/csh` and not with the `/bin/sh`.
The error looks like your script is executed with `sh`.