Templater Create a New Note from Template removes all other text

What I’m trying to do

I want to create new notes using a button. The new notes should link to the notes from where the button was triggered and the title should update with the current date. I need the functionality to create meeting and other notes which are linked to a project.

Things I have tried

I have a Meeting Template which looks something like this:

# Template Meeting

## Participants

## Topics


## Notes


## Documents


<%-*
const parentFile = await tp.file.find_tfile(app.workspace.getLastOpenFiles()[0]);
const parentLink = app.fileManager.generateMarkdownLink(parentFile, tp.file.folder(true));


tp.hooks.on_all_templates_executed(async () => {
  const file = tp.file.find_tfile(tp.file.path(true));
  await app.fileManager.processFrontMatter(file, (frontmatter) => {
    frontmatter["Project"] = parentLink;
  });
});

await tp.file.rename("Meeting " + tp.date.now() + " - ")

%>

But when I newer managed to make it work, something is always messed up. Either the templater code is run correctly but the rest of the template is missing, additional notes are created, or the templater code doesn’t run correctly.
I tried the button and the meta bind plugin and also just creating a new note via the comand pallet with templater lead to a new note with correctly run code but missing text.

There must be a way how this can work.

Thanks for your help, I’m loosing my mind…