Good Work -> Good Fruit
Bad Karma -> Bad Fruit
According to Shrimad Bhagwat Geeta
Lord Krishna said that
For good deeds people go to heaven and have good fruits, they go to hell for their bad ones and after facing both good in heaven and bad in hell they again come to earth again by taking rebirth.
I will edit here to provide link to that verse.
Then Lord said
To be free Oh Arjuna you have to leave the desire of fruits. Do Karma without willingness of fruit and worship me in parallel. Only surrender unto me can lead to the Moksha(Mukti or Freeing from rebirth).
Those who worship ghosts, reach ghosts, those who worship deity gets that deity but worshiping me only reach me. So you just worship me and perform your duties.
By doing so your Karma will be converted to "aaKarma". you will not have fruits, but those "Karma"s will be considered as I(GOD) have done.
So with no binding of fruits, such of you will get free from rebirth.
What is Moksha?
a state where a soul gets returned to "ParamDhama or Akshar Dham - a supreme abode" A permanent home of souls(body is considered as temporary home), where all souls resides. And again come to earth when their role is again in next World-Drama.
This state is never permanent. Because Lord Said:
Those who died, his next birth is absolutely happen, and the born one will absolutely die.
I will also put a link to that verse.
So for maybe some time soul will get Moksha, but for again to perform some duties and Karmas, soul has to take birth again. Except Shiva Parmatma, every body takes birth. All the souls. Even Lord Vishnu also. Only Lord Shiva never takes birth because he is considered as "Ajanma" birthless (who has never born).
Moksha is a state where soul is inactive and is considered as Mukti (Free from Karmas).
But there is also Moksha in real life known as "Jeevan Mukti" (Living Moksha)
Lord Krishna said,
Be neutral in doing your Karma, rise above hates and loves, have neutrality for Good or Bad, Happiness and sorrow and just perform your duty with clean heart. Consider Elephant, Gentleman, Demon and dog as same souls(Neutral for all). And you will free from any effects of your performed activity.
Such devotee is considered highest
In another verse in Guruleelamruta
Moksha is considered as Krupa "Blessings" of Guru Duttatreya(GOD who is considered as Combinations of all three Brahma, Vishnu, Mahesh)
Dhyanmulam Gurur murty, Pooja mulam Guru padam,
Mantravakyam Gurur Vakyam, Mokshamulam Guruh Kripa ||
means the last one Moksha mulam Guruh Kripa, means Guru's Kripa is root towards Moksha. Only God's blessing can make you reach Moksha, but is temporary. Moska is not permanent.
Example
is of 24 Tirthankara's in Jainism who are said to take birth again after attaining the birth, and All these tirthankara's were Hindu Kshatriyas!!
And Lord Vishnu himself takes birth millennium after millennium.