How to make Creating prefabs with a for loop in the editor

if (GUI.Button(new Rect(0, 0, position.width, 40), "Instantiate Prefab"))
Selection.activeObject = PrefabUtility.InstantiatePrefab(Selection.activeObject as GameObject);

There is such a code. As much as I want to use a loop How can I create a prefab?

(I used google translate. I'm sorry if I'm wrong)


Any kind of loop or code constructs works precisely the same in editor mode as in the game.