Create the file with the above contents and save it in your home directory as change-username.service
Then from within the terminal in your home directory, change ownership of the file to root…
sudo chown root:root change-username.service
Move the file to the systemd service directory (note: the trailing slash is important)…
sudo mv change-username.service /etc/systemd/system/
Then enable the service…
sudo systemctl enable change-username.service
Then reboot. After rebooting, your username, home directory and user group should all be changed. You should then disable the service…
sudo systemctl disable change-username.service