how can coroutines be made so that they wait for different amounts of time?

I am trying to spawn objects and trying to use the variable frequency to drive the time gap between each call of the coroutine. but it spawns just one block. can anybody please help me with this

void Update () {
        frequency = Mathf.Lerp(minMaxFrequency.x, minMaxFrequency.y, Difficulty.GetInterpolatedDifficultyPercent());
	}
IEnumerator SpawnBlock()
        {
            while (true)
            {
                              //process of spawning blocks.
                               yield return new WaitForSeconds(1.0f/frequency);
            }   
        }

the frequency seems to increase as expected but the spawning is not.

Instead of using a while loop you can try calling the coroutine recursively.

Something like this,

IEnumerator SpawnBlock()
{
        //process of spawning blocks.
        yield return new WaitForSeconds(1.0f/frequency);
        Startcouroutine(SpawnBlock());
}