Use metafields.
Code is either added to the rendered output either directly in template files, or as as custom-liquid blocks|sections, or even as app-blocks.
For frontend rendering use scripttags, sections rendering api, or app-proxies.
If you use metafields for frontend liquid templates the app , or the merchant , will still need to add that code to reference the variable.
https://shopify.dev/apps/metafields
I highly suggest you spend a week going over the dev docs for apps and themes to understand the integration methods, there’s a lot of subchoices here
https://shopify.dev/apps/online-store/theme-app-extensions
https://shopify.dev/apps/online-store/other-integration-methods
‘adding data to store|storefront’‘with app’ and other word variations on that problem is the search phrase as there’s a lot of subchoices depending on what your doing