Rotating game Object.

I know this questions have been asked multiple times and many solutions have been given.And some are working according to my requirements though in different example,but not in the actual project that i am working on. The problem is i want to rotate a gameobject around its center. The game Object here is not a simple one though. It may look something like

or may be some other form . All the component you see are different objects and as and when they are coming on the screen they are made child of this gameobject. So in the first case main game Object is named as singleLine. So all the components on screen are made child of singleLine. Now the position of singleLine would be the center of E-2. I am not been able to rotate it around the exact center of E-2 rather it moves in a circular manner. How to do this. I am posting a script out here of all the things that i have tried.

var targetItem : GameObject;
    var rotationRate : float = 1.0;
    var hit: RaycastHit;
    public var background:GameObject;
    public var cam:Camera;
    
    var smooth = 1.0;
    var tiltAngle = 30.0;
    
    function Update()
    {
    	if (Input.touchCount > 0) 
        {
             var theTouch : Touch = Input.GetTouch(0);
             var ray = cam.ScreenPointToRay(theTouch.position);
             if(Physics.Raycast(ray,hit))
             {
             	if(hit.collider==background.collider)
    		 	{	
    		 		if(Input.touchCount == 1)
                	{
     	               	if (theTouch.phase == TouchPhase.Moved) 
        	           	{
        	           		//this code is for x-axis rotation
        	           		if(Input.GetTouch(0).deltaPosition.y < 0|| Input.GetTouch(0).deltaPosition.y > 0)
    						{
    							var tiltAroundX = Input.GetAxis("Vertical") * tiltAngle;
    							var target = Quaternion.Euler (tiltAroundX, 0, 0);
    							targetItem.transform.rotation = Quaternion.Slerp(targetItem.transform.rotation, target,Time.deltaTime * smooth);targetItem.transform.Rotate(0,theTouch.deltaPosition.x * rotationRate,0,Space.World);
    							targetItem.transform.Rotate(theTouch.deltaPosition.x * rotationRate,0,0,Space.World);
    						}
        	           		if(Input.GetTouch(0).deltaPosition.x < 0  || Input.GetTouch(0).deltaPosition.x > 0)
    						{
    							var tiltAroundY = Input.GetAxis("Horizontal") * tiltAngle;
    							var target1 = Quaternion.Euler (tiltAroundY, 0, 0);
    							targetItem.transform.rotation = Quaternion.Slerp(targetItem.transform.rotation, target1,Time.deltaTime * smooth);
    							targetItem.transform.Rotate(0,theTouch.deltaPosition.y * rotationRate,0,Space.World);
    						}
                	        wasRotating = true;
                    	}    
             		}
             	}	
    		}
        }
    }

Have tried using only targetItem.transform.Rotate(0,theTouch.deltaPosition.y * rotationRate,0,Space.World); as well but again not helping out . Tried targetItem.transform.rotation(targetItem.transform.position,Vector3.down,20*Time.maximumDeltaTime); as well but again similar result.What could be the reason for it. Please help me.

Make an empty GameObject, call it center, and locate in the exact center of the object (the exact point that you want the rest of the components to rotate around).

Then make all the other components children of the center game object.

In your code, add a reference to the center object, and then it’s very simple to rotate everything around it:

center.transform.Rotate(xAngle, yAngle, zAngle);

for (var i : Transform in singleLine)
{
allPoint+= i.position;
}

        var groupCenter = allPoint/ singleLine.childCount;