How to Generate script from script

I am developing custom window editor, i stuck with generation script from script.

Never done it but script is a cs file that has text in it. You need a path. I’ve right-clicked in the Editor Window on a script → show in explorer. The ctr+c + ctr+v, duplicated file, ranamed it, and changed class name. It recompiled. And could attach as component.

Which means all you need is a path, as string collection with your code and simple saving it to cs file with right name and path. Not really anything fancier than creating txt files. The more difficult part will be to get the code probably.