FPS Camera slerp to aim at target

Hey, I use the following script to control the camera with the mouse:

    [SerializeField] private float sensX;
    [SerializeField] private float sensY;

    [SerializeField] private Transform orientation;

    private float yRotation;
    private float xRotation;

    public static CameraLook Instance;

    private void Awake()
        Instance = this;

    void Start()
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;

    void Update()
        if (Typewriter.Instance.IsWriting())

        Vector2 input = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));

        float mouseX = input.x * Time.fixedDeltaTime * sensX;
        float mouseY = input.y * Time.fixedDeltaTime * sensY;

        yRotation += mouseX;
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
        orientation.rotation = Quaternion.Euler(0, yRotation, 0);

How would I add a method with a target transform & rotation speed as input, lock the camera, slerp it until it aims at the target and resume input? I tried it many times but every time it resets back to the position it started from.

Thanks for the help!

First of all, in the Update() method you use Time.deltaTime and in the FixedUpdate() method you use Time.fixedDeltaTime, fixedDeltaTime is by default a constant (.02f) and deltaTime is frame rate dependent (1/frames per second).
Now that we have clarified the deltaTime issue I would suggest to add a variabile Transform target, at the start of Update() method you should add the following lines or a method calling them:

if (target){
    //Make camera lerp to target Transform
           transform.position = Vector3.MoveTowards(transfom.position, target.position, Time.deltaTime * speed);
            transform.rotation = Quaternion.RotateTowards(transform.rotation, target.rotation, Time.deltaTime * speed)
     //Check if we have reached the point, positionError value should go between .01f and .1f and rotationError between .1f and 1 (try experimenting with those)
             if(Vector3.Distance(transform.position, target.position) < positionError && Quaternion.Angle(transform.rotation, target.rotation) < angleError){
       target = null;
       //Lerp finished!
}else {
       //I deny the user to send any input 

Then I would add a public method to make someone set the cameraTarget:

public void SetCameraTarget(Transform target) {
    this.target = target;

I didnt quite understand if you needed just the rotation part, if so just remove the transform.position and Vector3.Distance part so you are good to go.

Good luck, have a great day!