Saving coordinates and transferring them to the second object

hi i have a question. there is an object to which the rotation script is attached, how to make it so that when this object is destroyed, the coordinates at which it stopped are saved, and these coordinates are transferred to the second object, which will appear after the destruction of the first

rotation script:

public float tilt;

void Update()
	transform.Rotate(Vector3.back * tilt);

You can store the position of the object before destroying in the Vector3 variable, and then assign this value to the position of the new object. For example (incomplete code):

Vector3 position; // position saveing variable

void ExampleDestroy()
    position = objectToDestroy.transform.position;

void ExampleInstantiate()
    newObject = Instantiate(objectPrefab);
    newObject.transform.position = position;