With a new Device File Explorer in Android Studio 3.1 I can open file from the device and see it's contents in Android Studio
File opens in edit mode and when I add some lines, save it and restart Android Studio and open this file again it's still empty.
Is there a way to save my changes to the device without clicking upload, locate and manually enter this file path?

You have to save the file on your computer, edit it and upload back the file on the device.