How can I fix errors in my bash script loop for running a curl command