What you need is to create a custom Menu then use a Modal Dialog to create a pop up window then use the Google Docs built in Method replaceBody to replace the values on the place holder. Check the sample code I am sharing so you can start somewhere.
Sample Code
code.gs
function onOpen() {
DocumentApp.getUi()
.createMenu("Sample Menu")
.addItem("Summon Firm", "openForm")
.addToUi();
}
function openForm() {
const html = HtmlService.createHtmlOutputFromFile('index')
.setWidth(300)
.setHeight(150);
DocumentApp.getUi().showModalDialog(html, 'Enter Your Name');
}
function insertInput(input) {
const doc = DocumentApp.getActiveDocument();
const body = doc.getBody();
body.replaceText('{{NAME}}', input);
}
index.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<p>What is your name?</p>
<input type="text" id="nameInput" placeholder="Enter name">
<br><br>
<button onclick="submitInput()">Submit</button>
<script>
function submitInput() {
const name = document.getElementById('nameInput').value;
google.script.run.withSuccessHandler(() => {
google.script.host.close();
}).insertInput(name);
}
</script>
</body>
</html>
Sample Output
References: