Question: why kylo ren had to die?
Answer: Much like how Leia gave up her life to give Kylo Ren the chance to snap back into Ben Solo, he emulated that to give Rey a chance to survive. Using the last of his own force energy to heal Rey of her injuries, he dies in true Skywalker fashion, in sacrifice.