I don't know your script, so need to guess based on what you write.
It looks like your script tries to execute commands directly over ssh. That is not supported in the Instant AP. The only supported login method is that you start an interactive session and enter the command there.
That is exactly how it must be done with telnet, as telnet does not allow direct execution of commands (there was rexec/rshell for that in the past; don't use it it is insecure, and for that reason replaced by SSH that has all in it).
To make it more clear, for example if you want to run the 'show version' command, what you would do as normal user is login, see that there is a prompt, then type 'show version', and see what comes out. With SSH it is possible to skip the prompt part, and directly execute the command (instead of the shell that gives the command prompt). This makes scripting easier and is probably the method that your script prefers when running over ssh, but is not supported by the Instant AP.
You will need to let your script check for the prompts and issue the commands just like it does on telnet.