Fix the 'getaddrinfo failed error'

Due to unreliable Internet the download used to stop when the hostname
couldnt get resolved.Now when this error is encountered the script keeps
trying untill its resolved.

Signed-off-by: Aditya Prasad <adityaprasadiskool@gmail.com>