I don't see the relation to programming (it certainly would fit better on SuperUser or Unix/Linux), but the reason that you are denied the permission to do what you do is related to the user IDs your pipe components are executed under.
With
sudo a | b
you are starting two processes, the first of them piping its output to the second one. The first one (`sudo`) executes another one (`a`) and feeds its output to `b`, which is executed with you UID.
If you change the way things are done (fetching install script as "you" and executing it as root), it will probably work. But you put a lot of trust in whoever puts this file onto that web site.