This is basically complaining that the previous two attempts were not ended successfully.
(I'll spare you a rant about vim
being a stupidly user-hostile default in 2025.)
I would delete the files thusly:
sudo rm /private/etc/sudoers.d/.mac.tmp.swp
sudo rm /private/etc/sudoers.d/mac.tmp
then I would edit the file using pico
:
sudo pico "/private/etc/sudoers.d/$LOGNAME"
which should look something like this:
Then paste in the two lines:
%admin ALL=NOPASSWD: chown -R mac:staff /Library/Audio/Plug-Ins
%admin ALL=NOPASSWD: chmod -R 755 /Library/Audio/Plug-Ins
so now it should look like this:
Then press CONTROL+X (not Command ⌘)
Press Y to confirm you want to save the changes
and then press Enter/Return to use the file name shown.