Smooth LookAt

Hello i’ve got this script and it works nice, but when the object is rotating it teleportrotates, i know i can use slerp or something like this:
transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(newDirection), Time.deltaTime);

But it doesnt work in my script…
Thanks for any help

using UnityEngine;
using System.Collections;

public class RandomMovenet : MonoBehaviour {

	public float velocidadMax;
	
	public float xMax;
	public float zMax;
	public float xMin;
	public float zMin;
	
	private float x;
	private float z;
	private float tiempo;
	private float angulo;
	
	// Use this for initialization
	void Start ()
	{
		
		
		x = Random.Range(-velocidadMax, velocidadMax);
		z = Random.Range(-velocidadMax, velocidadMax);
		angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
		transform.localRotation = Quaternion.Euler( 0, angulo, 0);
	}
	
	// Update is called once per frame
	void Update ()
	{
		tiempo += Time.deltaTime;
		
		if (transform.localPosition.x > xMax) {
			x = Random.Range(-velocidadMax, 0.0f);
			angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
			transform.localRotation = Quaternion.Euler(0, angulo, 0);
			tiempo = 0.0f; 
		}
		if (transform.localPosition.x < xMin) {
			x = Random.Range(0.0f, velocidadMax);
			angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
			transform.localRotation = Quaternion.Euler(0, angulo, 0); 
			tiempo = 0.0f; 
		}
		if (transform.localPosition.z > zMax) {
			z = Random.Range(-velocidadMax, 0.0f);
			angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
			transform.localRotation = Quaternion.Euler(0, angulo, 0); 
			tiempo = 0.0f; 
		}
		if (transform.localPosition.z < zMin) {
			z = Random.Range(0.0f, velocidadMax);
			angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
			transform.localRotation = Quaternion.Euler(0, angulo, 0);
			tiempo = 0.0f; 
		}
		
		
		if (tiempo > 1.0f) {
			x = Random.Range(-velocidadMax, velocidadMax);
			z = Random.Range(-velocidadMax, velocidadMax);
			angulo = Mathf.Atan2(x, z) * (180 / 3.141592f) + 90;
			transform.localRotation = Quaternion.Euler(0, angulo, 0);
			tiempo = 0.0f;
		}
		
		transform.localPosition = new Vector3(transform.localPosition.x + x, transform.localPosition.y, transform.localPosition.z + z);
	}
}

I made a video tutorial on this subject:

LookAt Tutorial Unity