Your final two commands are regular shell (e.g. Bash) whereas your main script is Python (as per the #! line at the start).
What "echo A > B" is does is write content A to file B - the closest equivalent in Python seems to be print:
print('0',file='/sys/class/backlight/rpi_backlight/bl_power')
But the recommended way appears to be this convoluted thing:
with open('/sys/class/backlight/rpi_backlight/bl_power','w') as f: f.write('0')
Possibly using buttonState1 instead of 0 and 1 ...and actually looking at the code, I just noticed you've got subprocess.call calling what looks like a shutdown shell command, so you can simply use that for shell commands without needing to translate - possibly changing the shutdown one to:
"echo 1 > /sys/class/backlight/rpi_backlight/bl_power && shutdown -h now"
and adding the inverse for starting up - it seems weird to have this in an endless polling loop (the while true + sleep combo), but maybe that's the only way this stuff works?
:/