I think you need to expand a bit; what you've written doesn't make sense to me.
You seem to be typing cmds that would be better typed into the cmd line direct, not into the vi editor, which is used for creating shell progs.
Let me guess...
To create a shell prog to do backups,
# this cmd creates the file named and opens it in vi/vim
# now you would add the cmds that actually do the backup
# this is done after exiting from the file above
# ie back in cli
chmod u+x backup
These should help
HTH & Welcome to LQ