Pingpong back and forth, but player rotates in the correct position coming back

Hello. I have a small dog that is going back and forth in my scene. I have been able to figure out how to have it pingpong from point A to point B and back to point A, … However, when the dog comes back, it is walking backwards. Does anybody know how I can get the dog to automatically go to one point, turn around and go back to the other, and then continually loop? Any help would be greatly appreciated.

Here is the C# script I am using:

using UnityEngine;
using System.Collections;
public class BackAndForth : MonoBehaviour
{
public Transform farEnd;
private Vector3 frometh;
private Vector3 untoeth;
private float secondsForOneLength = 20f;

void Start()
{
frometh = transform.position;
untoeth = farEnd.position;
}

void Update()
{
transform.position = Vector3.Lerp(frometh, untoeth,
Mathf.SmoothStep(0f,1f,
Mathf.PingPong(Time.time/secondsForOneLength, 1f)));
}
}

Thanks. Let me try to re copy and paste the code properly.

using UnityEngine;
using System.Collections;

public class BackAndForth : MonoBehaviour

{
    public Transform farEnd;
    public Transform target;
    private Vector3 frometh;
    private Vector3 untoeth;
    private float secondsForOneLength = 20f;

    void Start()
    {
        frometh = transform.position;
        untoeth = farEnd.position;
    }

    void Update()
    {
        transform.position = Vector3.Lerp(frometh, untoeth,
            Mathf.SmoothStep(0f,1f,
                Mathf.PingPong(Time.time/secondsForOneLength, 1f)));
    }
}