Inject tag script in liquid

Hello,
I’m trying to add a custom tag to the shop immediately when my app is installed, but I’m having a hard time figuring out how. This simple task has proven quite difficult for me

My goals are:

  1. Add a custom script to the shop immediately when the app is installed with/ post-script-tags
  2. Use REST Admin APIs mutations post-script-tags and delete-script-tags w/ Shopify’s Polaris’s component
    if SettingToggle enabled = post-script-tags
    if SettingToggle disabled = delete-script-tags

Can anyone point me in the right direction? Could you send me some example code of what others have done? As each time we inject the script into the liquid, the script does not run.
This is an application that needs to be installed seamlessly by clients, so I can’t manually alter their template files.

Thanks in advance.

I need your urgent help.