Writing a script to press a key combination to set your screen's brightness seems a bit of a detour to me. You can directly set your screen brightness on log in by adding the command:
xrandr --output <your_screenname> --brightness 0.7
to your startup applications. Of course, instead of
0.7 (=70%), you can use any value you prefer.
<your_screenname> by the actual name of your screen. Find out your screen's name by looking into the output of the command:
Look for the word
connected; the name before that is your screen's name
Add the command to your startup applications
Open Startup Applications (Dash > Startup Applications) and choose "Add". Add the command above and next time you log in, your screen's brightness will be set automaically to the value you defined in the command.