Doing that is risky. You could get a bad package that crashes your system.
If you really insist there's already an APT auto-updater package in DebIan / Raspbian.
I'm on a phone now so it's not easy for me to find that.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3B*3, 3B+
Please post ALL technical questions on the forum. Do not send private messages.