What did I do wrong Camera Script?

I am making a bouncing and rotating square go through a 3D level and am having issues getting the camera to behave the way I want. I have managed to stop it from rotating when the square does and can change the depth on the z axis however I am unable to figure out why I cant use the same method to change height along the y axis. Here is the script I have attached to my camera.

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

public class rotate : MonoBehaviour
    public GameObject player;
    // Start is called before the first frame update
    void Start()


    // Update is called once per frame
    public float cameraHeight = 20.0f;
    public float cameraDepth = 20.0f;
    void LateUpdate()
        Vector3 pos = player.transform.position;
        pos.y += cameraHeight;
        transform.position = pos;
        Vector3 pos1 = player.transform.position;
        pos1.z += cameraDepth;
        transform.position = pos1;


Vector 3 stores x, y, z value no need to make 2 position store both y and z in one Vector3
to learn more about vector 3 go to this link Unity - Scripting API: Vector3
@shooterman if it helps please give alike means a lot.