Short answer, TLDR: No, a simple script will not suffice for what you are trying to do. But ...
You will have better luck using a third party like this one: https://github.com/pirate/mac-keyboard-brightness. His code can take user input and manipulate the keyboard for you. But I am not sure if this was tested in Mojave but you are welcome to try.
Long Answer, for the curious:
Certain system settings or running hardware tasks on a Mac are initiated and ran with kernel extensions and continue to run with the
kextd daemon. What drivers are for Windows are how kernel extensions are for Mac OS. Without kernel extensions your Mac OS would not boot properly.
You can safely test with your sound on your Mac using information about removing kexts here, but be sure to back up your files: http://osxdaily.com/2012/05/30/how-to-completely-disable-audio-sound-in-mac-os-x/
Take a look the code written there by Pirate, in his code in keyboard-brightness.c he does a good job dissecting the Mac. You can see how a bit more complex your script would be if you tried to tackle this through code. A simple bash script would not suffice.
In Pirate's code you can see that he accesses the keyboard light with the Foundation framework and the IOKit framework, written in Objective C/C++. If you are comfortable with this language then you should try to dabble more with his code.
Why running defaults didn't catch anything?
defaults doesn't show anything is because
defaults is meant to edit plist files only.
How can I see my kernel extensions? You can see a full list of kernel extensions currently running in terminal with the following command:
You can also see a list of all your installed kernel extensions under:
In terminal you can see which keyboard kext file you have by running grep:
kextstat | grep "Keyboard"
I do not have a laptop, but I am safely assuming you will also have a keyboard kext file that will look similar to mine:
Where can I learn more about the IOFramework? https://developer.apple.com/documentation/iokit?language=objc. On Pirate's git page you can see he also wrote his code in swift4, which might be easier to understand. You can switch back and forth from ObjC and Swift language types on the Apple Developer Page.
I hope this answer was useful to you.