Ray Cast Click on Enemy - Change Current Target

My raycast target enemy works perfect, my only problem is when I have a target the only way to untarget is to kill the enemy or to right click. I want to make it so if I have a target and i choose to click another one, the target will change. Cant figure it out!

void Update () {


		if( Input.GetMouseButtonDown(0) && newon == true)
		{

			Ray ray = Camera.main.ScreenPointToRay( Input.mousePosition );
			RaycastHit hit;
			
			if( Physics.Raycast( ray, out hit,  100 ) )
			{
				float distance = Vector3.Distance(hit.transform.position, transform.position);

				
				if(distance < 8) {
				string hitTag = hit.transform.tag;
				if (hitTag == "enemy" && newon == true)
				{
				Debug.Log( hit.transform.gameObject.name );
				target = hit.transform.gameObject;
					SelectTarget();
				}
				}

			}
		}


		if (Input.GetMouseButtonDown (1)) {
				DeselectTarget();
				}

If “newon” is to check that a target is already selected, then if you want to be able to select a new target anyway all you have to do is remove the if newon = true part.

Depending on what those functions do you may also need to add DeselectTarget() on the line before SelectTarget()