rotating a child object around parent object

I am trying to rotate a child object (Sphere) around its parent object (Capsule) with a mouse click

Whenever i click on the left mouse the sphere is rotating however it is only moving one step to the right and not moving constantly around the capsule

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RayCast : MonoBehaviour
{
int speed = 30;
public GameObject Capsule;
public  GameObject Sphere;

   Vector3 axis = new Vector3(0,1,0);


  
     public Vector3 cylinderOffset = new Vector3(0, 1f, 0);
    
     public Vector3 sphereOffset = new Vector3(3f, 0, 0);
    void Start()
    {
     //Objects = new List<GameObject>();

    }

    void Update()
    {

        if(Input.GetMouseButtonDown(0))
        {
            Camera c = GetComponent<Camera>();
            Ray r = c.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

         
            if (Physics.Raycast(r, out hit))
             {
                 if (hit.transform.CompareTag("Untagged"))
                 {
                     Capsule.transform.position = hit.point + cylinderOffset;  
                     GameObject xCapsule = Instantiate(Capsule);

                   }


                 else if (hit.transform.CompareTag("Capsule"))
                  { 
                    GameObject xSphere = Instantiate(Sphere,hit.transform); 
                    xSphere.transform.position = hit.transform.position + sphereOffset;   }
                    
                   else if (hit.transform.CompareTag("Sphere")){
                          hit.transform.RotateAround(Capsule.transform.position, Vector3.up, 30 * Time.deltaTime);    }  
                    
                    }   }
                    
                    
                    
                    
                     } 
                 
                 }

how can i make it move around the capsule without stopping?

I edited your code like this:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RayCast : MonoBehaviour
{
	int speed = 30;
	public GameObject Capsule;
	public  GameObject Sphere;

	Vector3 axis = new Vector3(0,1,0);

    GameObject sphere;//for holding the object to rotate around

	public Vector3 cylinderOffset = new Vector3(0, 1f, 0);
	
	public Vector3 sphereOffset = new Vector3(3f, 0, 0);
	void Start()
	{
		//Objects = new List<GameObject>();
		sphere = null;
	}

	void Update()
	{

		if(Input.GetMouseButtonDown(0))
		{
			Camera c = GetComponent<Camera>();
			Ray r = c.ScreenPointToRay(Input.mousePosition);
			RaycastHit hit;

			if (Physics.Raycast(r, out hit))
			{
				if (hit.transform.CompareTag("Untagged"))
				{
					Capsule.transform.position = hit.point + cylinderOffset;  
					GameObject xCapsule = Instantiate(Capsule);

				}
				else if (hit.transform.CompareTag("Capsule"))
				{ 
					GameObject xSphere = Instantiate(Sphere,hit.transform); 
					xSphere.transform.position = hit.transform.position + sphereOffset;   
				}
				else if (hit.transform.CompareTag("Sphere")){
					sphere = hit.collider.gameObject;
					//hit.transform.RotateAround(Capsule.transform.position, Vector3.up, 30 * Time.deltaTime);    
				}  
			}   
		}
		
		if(sphere != null){ //now it will rotate infinitely unless you set sphere to null again
			sphere.transform.RotateAround(Capsule.transform.position, Vector3.up, 30 * Time.deltaTime);   
		}
	} 
}

A good solution was posted by mchts but I thought I would explain why this works. The method GetMouseButtonDown(0) fires only on the frame where that button was initially pressed, and your rotation code was only called when this was true. So that is why your code was only firing once per click. A solution depends on what you want to happen. For instance, Input.GetMouseButton(0) returns true if the button is pressed down, not just on the first frame it was pressed, so if your animation is dependent on the mouse button being pressed you would want to use this instead of Input.GetMouseButtonDown(0). If your mouse click is only meant to select a target and play the animation independently of whether the mouse button is pressed then you would want to use mchts solution.