Headbob in C#

How can I make my FPS Character headbob? I tried everything but I cannot get my character to headbob

using System.Collections;
using System.Collections.Generic;
using System.Linq.Expressions;
using UnityEngine;

public class CurveControlledBob
    public float HorizontalBobRange = 0.33f;
    public float VerticalBobRange = 0.33f;
    public AnimationCurve Bobcurve = new AnimationCurve(new Keyframe(0f, 0f), new Keyframe(0.5f, 1f),
                                                        new Keyframe(1f, 0f), new Keyframe(1.5f, -1f),
                                                        new Keyframe(2f, 0f)); // sin curve for head bob
    public float VerticaltoHorizontalRatio = 1f;

    private float m_CyclePositionX;
    private float m_CyclePositionY;
    private float m_BobBaseInterval;
    private Vector3 m_OriginalCameraPosition;
    private float m_Time;

    public void Setup(Camera camera, float bobBaseInterval)
        m_BobBaseInterval = bobBaseInterval;
        m_OriginalCameraPosition = camera.transform.localPosition;

        // get the length of the curve in time
        m_Time = Bobcurve[Bobcurve.length - 1].time;

    public Vector3 DoHeadBob(float speed)
        float xPos = m_OriginalCameraPosition.x + (Bobcurve.Evaluate(m_CyclePositionX) * HorizontalBobRange);
        float yPos = m_OriginalCameraPosition.y + (Bobcurve.Evaluate(m_CyclePositionY) * VerticalBobRange);

        m_CyclePositionX += (speed * Time.deltaTime) / m_BobBaseInterval;
        m_CyclePositionY += ((speed * Time.deltaTime) / m_BobBaseInterval) * VerticaltoHorizontalRatio;

        if (m_CyclePositionX > m_Time)
            m_CyclePositionX = m_CyclePositionX - m_Time;
        if (m_CyclePositionY > m_Time)
            m_CyclePositionY = m_CyclePositionY - m_Time;

        return new Vector3(xPos, yPos, 0f);

@thatguylogibusiness, you have the code to bob, but are calling it as a part of an animation loop or coroutine? It won’t happen if you don’t do that.