The brightness utility is very useful, so it’s worth installing. I would just like to point out that plain AppleScript can do this too (using GUI scripting, but not as tried the OP):
-- script: DIM THE DISPLAY
-- In the Keyboard preferences:
-- set checkbox "Use F1,F2, etc. keys as standard function keys"
-- In the Accessibility anchor of Security & Privacy:
-- allow to frontmost application to control your computer
tell application "System Events"
key down 63 -- holding Fn key
repeat 16 times
-- gradually decreaze the brightness
key code 145 -- to increaze, use 144
end repeat
key up 63
end tell
If someone has a solution to this simple task without a third-party utility and GUI scripting, then I would be grateful for posting it in this topic.