How can I display dynamic data in Script Tag API

Okay, thanks.
But I think RestAPI will take some time. Because after loading the script tag then I hit an API after getting the response. I think it’s an appropriate solution.

Any other suggestions?