Thanks for the replies, @ComplexPoint. For the record, I did both read the Wiki and many of the relevant threads before asking for help — and, having used Keyboard Maestro for years, I have a ton of other macros that have successfully used shell scripts before, which is why this one stumped me. Oddly, a very similar macro to mount the drives worked perfectly, but you're right, here it seems like I need to use the full path of diskutil. The script then unmounts all the drives. I still get the error message that the script failed to run, but it is unmounting the drives, at least.
I was able to check what the "$KMVAR_DriveName" is expanding to by adding an "echo" command to the top of the shell script. It expands as expected, to each drive name in succession (as the loop runs).
Have a great day.