Clock edge is not getting detected inside forever loop

In reply to chr_sue:

Thanks. Also updated the code in my question.