What happens when you run the exact same input on the command line?
ie, try running:
inivec MV 3 aa; done
Then from the errors you receive there you can work until you get the right input.
Remember that a script simply automates something you would have done by hand on the command line, so if it doesn't work there then it will never work in the script.