There's a couple of things wrong here
- Shelob wasn't killed by Sam (as stated by another user). She was wounded greatly, but definitely not mortally, and she retreated back into her caves to heal
- Ungoliant (the mother of all spiders, including Shelob) did not eat "the original sun and moon". She drank the light of the two trees which provided light to Arda before the sun and moon, causing them to rot and die.
- The two trees weren't the original sun and moon. Before the two trees, there were the two lamps which stood on or near the poles of Arda and were the original lights of the world. I don't think it's fair to call either the lamps or the trees iterations of the sun and moon since the idea of a day-night cycle didn't exist prior to the sun and moon, at least in how we think of it. During the age of the two lamps (the Spring of Arda), both lamps shone constantly (no transition for time of day). During the age of the two trees, the trees would bloom throughout the day on a cycle, alternating which one was in full bloom. This is closer to day and night, but the trees shone so brightly that dark night never existed. Plus, the trees blooms mingled twice a day, essentially creating two "noons" per day