I'm Trying To Get Walking "animation"

i’m trying to get walking animation without animation
i’m trying to get the character to move up and down (on y) if it directed change in position x or z
i have CharacterController on my character

    float _x;
    float _y;
    float _z;
void Update()
    {
        PlayerMove();
    }

    private void lastPosition()
    {
        _x = transform.position.x;
        _y = transform.position.y;
        _z = transform.position.z;

    }

    private void PlayerMove()
    {
        lastPosition();

        if(_x != transform.position.x || _z != transform.position.z)
        {
            _y += 0.5f;
        }

I have done procedural walking animation using only sin, I can attest it’s feasible.