You should be using notepad for the edit, otherwise the avast self-defence module will block it.

If you are using notepad - I don’t know what your Operating System is, but it may well be that you need do a run as on notepad.exe to have the necessary permissions.