Linux exposes a special interface to control screen brightness via sysfs in /sys/class/backlight (source).
The problem is that in Lenovo Legion 5 there are two modules registered to control screen brightness - AMDGPU and ideapad modules:
$ ls /sys/class/backlight
amdgpu_bl0
ideapad