Hello everyone! I have just installed Ubuntu. I have not used this operating system for many years so I am now a beginner...again. So, in particular, I want to run a script at boot.

I have done some research and saw that I had to run the command:
sudo vi /etc/rc.local
however, after this, I do not know how to save the file. I somehow found out to use the down arrow to get to a blank spot and then press the insert key to start typing in the command. From there, I was stuck so it was a dead end. The command I wish to insert there would be as follows:
sudo macchanger --random enp5s0
After realizing this did not work, I tried to go to "Startup Applications Preferences" and click "Add" and I typed in the above command into the command spot and hit save. I then rebooted the system and once back in, I opened up a terminal and typed in
"ip addr" and the address was not changed meaning, it did not work. I am at a loss and do not know what to do anymore.

Thanks in advance!