How Do I Save An Instantiated Object?

I am trying to create a GameObject through a prefab, however when I end the game the object is deleted along with all of the information that it contained. I know this what is supposed to happen but I was wondering if there was any way to either save its information, stop it from deleting, or turn it into prefab.

here is my current code,

using UnityEngine;
using UnityEngine.UI;

public class NewMaterialCreator : MonoBehaviour
{
    public Button CreateMaterial;
    public Transform SpawnPosition;
    public GameObject MaterialCodePreset;
    public Text MaterialName;
   
    void OnEnable()
    {
        CreateMaterial.onClick.AddListener(MyFunction);
    }
    void MyFunction()
    {
         var NewMaterial = Instantiate(MaterialCodePreset, SpawnPosition.position, SpawnPosition.rotation);
        NewMaterial.name = MaterialName.text;

    }
}

Thanks in advance for the help

have a look at the docs, how you save objects as prefabs