The rotation keeps resetting after I stop input, how do I keep the rotation even after the input has stopped?

I made a child for the player to rotate around, it works fine but the rotation resets when input has stopped. Here’s my code.

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

public class RotateChild : MonoBehaviour {

public Transform child;
private float rotSpeed = 5.0f;

// Update is called once per frame
void FixedUpdate () {
    {
		transform.LookAt (child);
	}

	{
		if (Input.GetKey (KeyCode.RightArrow))
			transform.RotateAround (Vector3.zero, Vector3.up, rotSpeed * Time.deltaTime);
	}

	{
		if (Input.GetKey (KeyCode.LeftArrow))
			transform.RotateAround (Vector3.zero, Vector3.down, rotSpeed * Time.deltaTime);
	}
}

}

You need a value to save the state.

public Transform child;
private float rotSpeed = 5.0f;
private int rotateDir = 0;

void FixedUpdate () {
    transform.LookAt (child);

    if (Input.GetKey (KeyCode.RightArrow))
        rotateDir = 1;

    if (Input.GetKey (KeyCode.LeftArrow))
        rotateDir = -1;

    if(rotateDir != 0)
        transform.RotateAround (Vector3.zero, Vector3.up*rotateDir , rotSpeed * Time.deltaTime);

}