If I understood that script correctly, it does something very different. My phone doesn't even have the tools the script uses (iwlist/iwconfig), nor apt-cache search founds them. Are they from some external repo?