purushah prakriti-stho hi
bhunkte prakriti-jan gunan
karanam guna-sango ’sya
sad-asad-yoni-janmasu

"The living entity in material nature thus follows the ways of life, enjoying the three modes of nature. This is due to his association with that material nature. Thus he meets with good and evil among various species."

....The soul in the body has to feel the happiness and miseries as they are inevitable in this World. Now we can see the equation correctly. Atman desires in pleasures and so atman resides in a body. Because of this association with body, atman does so many activities, which make to acquire more and more karma. Thus cause and effect are the same. That is, atman takes a body as residence to spend karma; while being resident, more and more activities are performed, which make atman to acquire more and more karma. It is a cause - effect - cause cycle. Karma causes to reside in a body and enjoy [or suffer] effects. Effects cause more actions and so more karma accumulate as effects. Such acquired karma causes again residing in a body, and so on. Purusha =atman, prakruti-stha = residing in body, gunan = [satva, rajo and tamo] qualities, prakruti-jan = always associated with body. These three satva-rajas- tamas qualities are always associated with the body. Action is propelled by these three qualities. That is why pleasures and pains. Thus atman housed in body, experiences happiness and sorrow, result of the actions driven by satva-rajo-tamo qualities of the body. Sad-asad-yoni-janmasu = [thus, atman] takes variety of births in many bodies [like Devas, human, animal, bird,etc.], karanam = reason being, guna-sangha = [attachment to] the group of [satva-rajo-tamo] qualities. That is the attraction or attachment to the pleasures and miseries, generated by the actions caused by these qualities. This attachment causes more and more births. This is what Nammalwar gave as reply to Madurakavi Alwar's question. Atman again and again takes birth in bodies. That is, atman, experiencing the happiness/sorrow as results of the actions of the body and remaining always in a body, in every birth. Therefore, this sloka is closely connected with Nammalwar.