Trying to add off button with script at startup, not working

For proper shutdown when you switch of the car it might be more recommended to look at one of the Pi UPS.