You can save file as another file in vi editor after you make changes to the current file, so that you can quit without saving and still retain the changes in another file.

:w! newfile.txt

or

:w! /var/newfile.txt

Thanks