camera movement is very choppy on y axis

I am using this script for player movement and camera movement, and for some reason its really choppy when looking left or right.

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

public class player : MonoBehaviour
    Transform cam;
    Rigidbody rb;
    public float speed, mouseSensitivity, maxspeed;
    public bool grounded;
    float xRotation;
    // Start is called before the first frame update
    void Start()
        Cursor.lockState = CursorLockMode.Locked;
        rb = GetComponent<Rigidbody>();
        cam = Camera.main.transform;

    // Update is called once per frame
    void Update()
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        rb.AddForce(transform.forward * z * speed, ForceMode.VelocityChange);
        rb.AddForce(transform.right * x * speed, ForceMode.VelocityChange);
        rb.velocity = new Vector3 (Mathf.Clamp(rb.velocity.x, -maxspeed, maxspeed), rb.velocity.y, Mathf.Clamp(rb.velocity.y, -maxspeed, maxspeed));
        if(x == 0 && z == 0)
            rb.velocity = rb.velocity * 0.99f;


    //camera movement
    void camMove()
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
        transform.Rotate(transform.up, mouseY);
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        cam.transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);

Because mouse X and mouse y inputs give you the actual distance the mouse moved that frame, not a speed per second, you don’t need to multiply it by Delta time. Unintuitive but true.

You are directly assigning xRotation to camera regardless of what rotation it is in current. You should add xRotation to current camera rotation, that way, camera can be more smoother.

For Ex.

cam.transform.localRotation += Quaternion.Eular(xRotation, 0f, 0f);