Vim can be kind of tricky your first few times using it. Knowing how to save and abort your changes along with being able to exit the editor is a great place to start.
:w writes changes and keeps the file open.
:x writes changes and closes the editor.
:quit! aborts changes and closes the editor.
:w !sudo tee % saves changes made by an unprivileged user.