Original sentence: Along with this idea of saṃsāra, the ancient scholars developed the concept of moksha, as a state that released a person from the saṃsāra cycle.This question led to the conception of an afterlife where the person stayed in heaven or hell, in proportion to their merit or demerit, then returned to earth and were reborn, the cycle continuing indefinitely
Edited sentence: Along with this idea of saṃsāra, through meditative experiences, sages developed their consciousness and reached the understanding of moksha, as a state that released a person from the saṃsāra cycle.This question led to further spiritual development and the understanding  of an afterlife where the person stayed in heaven or hell, in proportion to their merit or demerit, then returned to earth and were reborn, the cycle continuing indefinitely