That script is just:
defaults -currentHost read com.apple.notificationcenterui doNotDisturb
I'm having some issues with that simulated keystroke recently though (10.14.6)...
If I press the shortcut myself, it works. But from KM it's not working. I've tried toggling the shortcut on/off in system prefs, and tried restarting KM. It just gives me the normal error sound when I try it (including just trying that one action).