SharePoint Content Editor like Functionality

I need help to achieve Sharepoint’s Content Editor like functionality (SharePoint basically allows users to add their custom script + HTML or HTML file to import on the Sharepoint’s page). I want to do some customisation in my Angular SPA and want to further customize the app using external HTML + JS Code for different environment as this is SaaS application and every environment is different. I am try to do this by using following code but I did not get any success.

Basic Idea is external HTML will have code which can interact with the app and further customize it

<html>
<script>
const promiseOfSomeData = fetch("https://....somesite/Test.html").then(r=>r.text()).then(data => {
    console.log('in async');
    return data;
});
window.onload = async () => {
    let someData = await promiseOfSomeJsonData;
    document.querySelector('#some.selector').innerHTML = body;
    console.log("onload");
};
</script>

This is Native Code and HTML here