unity – Why the transform is not rotating back smooth to his original starting rotation using lerp?

(RequireComponent(typeof(Animator)))
public class Test : MonoBehaviour
{
    public Transform lookAtTarget;
    public AnimationCurve curve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
    public float duration;
    public float duration1;

    private float t;
    private float t1;
    private Quaternion rot;

    private void Start()
    {
        t = 0;
        t1 = 0;
        rot = transform.rotation;
    }

    void LateUpdate()
    {
        Vector3 forward = transform.TransformDirection(Vector3.forward);
        Vector3 toOther = lookAtTarget.transform.position - transform.position;

        if (Vector3.Dot(forward, toOther) < 0)
        {
            t1 += Time.deltaTime;
            float s = t1 / duration1;

            transform.rotation = Quaternion.Lerp(transform.rotation, rot, curve.Evaluate(s));
        }

In the if part the transform is like “jumping” at once to the original rotation and there make some lerping or not doing at all and I want that it will lerp smooth slowly from it’s current rotation back to the original rotation(rot).

Same effect when turret is cool down when there is no target so the turret smoothly return to his original rotation.

I tried also :

transform.rotation = Quaternion.Lerp(transform.rotation, rot, s);

But the same problem remains.