How to initiate creating a file from a panel?

Goal: a new button “add” in a panel should create a new .yml file in the page folder.

The functionality “Add Page” is actually very similar to what I need. However, instead of a folder+txt-file, a YAML-file should be created and thereafter made available for editing (e.g. in a simple textarea).

Is that possible? How?

What would be the purpose of such .yml files in the content folder?

In what sense is that relevant?
To my mind it wouldn’t make a lot of sense to explain the application specific purpose of that file.
I will consider alternative ways to solve the problem. But first I’d like to understand how you’d do it in the mentioned way.

If it is on a per page basis, you could create a custom field or section.

Thanks. But I don’t quite understand what that means. I think I understood by now how to create a section, custom field is less clear. But how would that create a file?
To my mind, what I’d need is more going in the direction of some sort of a callback or hook. I.e. a custom action that the click on a button in the panel would trigger on the server.

Well, the section would need a dialog where users could create the file, and then a custom API endpoint, that stores the stuff entered into the dialog.