script for object to rotate around and come back

Hello , I need to write a script that have distance variable and speed variable the distance for the rotation degree and the speed for the speed of rotating & I want to when I Press H button for example my object rotate around z axis and come back to his first position but I write many codes and finally write this code but I can’t find any success.
Before this code I use animation but in my case animation isn’t useful.

function Action_Pass_4(){
	
	
	if(PassStage == false){

  	transform.Rotate(0,0,PassSpeed*Time.deltaTime);
					 }
	if(Quaternion.Angle(transform.rotation,SecoundRotation)< 1){
	
	PassStage = true;
															  }
	if(PassStage == true){
	
	transform.Rotate(0,0,-PassSpeed*Time.deltaTime);
	
	if(Quaternion.Angle(transform.rotation,FirstRotation)< 1){
	
	Pass_4 = false;
	PassStage = false;
															  }
					 }


}

I know another way, that might work for you.

  1. create a game object in the center of rotation
  2. make your object child of this game object
  3. rotate the game object and you will see, that your child object moves around the game object

Finally You can easily get the needed values.

The rotation can be modified via the game object.