silt, you need to learn what you're actually doing. "vi" is an actual application, with its own set of commands.
you need to hit the 'esc' key on your keyboard to then be able to issue a command to save, which is (without single quotes), ':wq'. That tells the app to pay attention, write, and then quit, sequentially.
http://www.cs.colostate.edu/helpdocs/vi.html