what to change that the camera does not move on the y-axis

using UnityEngine;

public class FollowPlayer : MonoBehaviour {

public Transform player; 
public Vector3 offset;		


void Update () {
	
	transform.position = player.position + offset;
}

}

You can do:

var targetPosition = player.position + offset;
transform.position = new Vector3(targetPosition.x, transform.position.y, targetPosition.z);

Let me know if that works for you.