Unexpected symbol 'private' ...

Okay, noob question here. Running this simple script to move a cube that I’ve borrowed/adapted from someone else. Of course, I’m new to this whole thing and the script doesn’t seem to like the use of “private” in this case, when calling MoveTowardsTarget. Result is, I don’t know what to do… I feel like somewhere in there I probably need another “}” but where??

Any help would be appreciated, thanks!

	void Update () {

	private void MoveTowardsTarget() {

		public float speed = 5;

		Vector3 targetPosition = new Vector3(0,4,0);
			
		Vector3 currentPosition = this.transform.position;

		if(Vector3.Distance(currentPosition, targetPosition) > 0.1f) {
			Vector3 directionOfTravel = targetPosition - currentPosition;
			directionOfTravel.Normalize();

			this.transform.Translate(
				(directionOfTravel.x * speed * Time.deltaTime),
				(directionOfTravel.y * speed * Time.deltaTime),
				(directionOfTravel.z * speed * Time.deltaTime),
					Space.World);
	}
}

Methods can not contain internal method definitions. Here you are trying to define the MoveTowardsTarget method inside the scope of the Update method. You can only call methods from within other methods, not define them. So maybe you want instead:

void Update() {
    MoveTowardsTarget();
}

private void MoveTowardsTarget() {
    ... All the code to move towards the target
}