Great question — answering as the UphillTech team:
There is no problem with your script in itself, but with the files it tries to access : all files & directories located under the /sys directory are belonging to root (which is not shown by the getfacl command). What you can do is running the script as root, or to change the permissions of the files you try to access (but this is not recommended at all).
Full answer by cocosushi: https://unix.stackexchange.com/a/349454 (CC BY-SA 3.0).
Need it done for your business? UphillTech.