looping in a shell script and keep updating local JSON file