To quit the vi editor:
:q
If you have edited (changed) the file you will be prompted with the message:
No write since last change
You can either save the changes or quit without saving any of the changes you have made.