So in order to find out what is causing the problem, I ended up uninstalling Ubuntu and changing to different distribution (Manjaro) and to different desktop environment (Xcfe) and to surprise of nobody, the problem with saving the xconfiguration file remains exactly the same. Then I figured out what is causing the problem.
First of all, the file /etc/X11/xorg.conf does not exist.
So, I created the file in terminal by typing sudo nano /etc/X11/xorg.conf and pressing enter
then I pressed ctrl-o to save the empty xorg.conf file
then I closed the nano editor with ctrl-x
Now there is the file but it is read only so still the nvidia settigs cant save… therefore one more fix.
In terminal give the following command:
chmod u=rw,g=rw,o=rw /etc/X11/xorg.conf
now everyone has read and write access to that file. Note: I am not sure if this compromises something security-wise but after that command my Nvidia x server settings no longer gives error message when saving settings.
Let me know if that works for you too!
1 open terminal
2 sudo nano /etc/X11/xorg.conf
3 save and quit
4 chmod u=rw,g=rw,o=rw /etc/X11/xorg.conf
5 enjoy saving settings