Editing metadata.json file

There are a lot of ways but a common way would be to use sed to search for and replace the text you are editing.

Alternatively, if that file is always the same, you could create patch and apply it in the script.

You could also just pull a copy down from an external source and overwrite it.