Why didn’t Misa kill L second time she got shinigami eyes? If she wasn't going to use them to kill him, then why did she get them, knowing her lifespan was going to be shortened? Why did Rem agree to do it?
These are actually several questions and should be asked separately (And at least one of them has already been answered). Also, please be sure to include your own research on the matter in future questions.
Why didn’t Misa kill L second time she got shinigami eyes?
The event that should have lead to her killing L was her obtaining ownership and thus regaining her memory. The only reason she made the deal a second time is that she does not remember the name and wants to see it again. However, she never meets L again and thus does not see his name.
Why did she get them then, knowing her lifespan was going to be shortened?
From a logical point of view, since Misa was saved by Gelus, she received his remaining life span and might potentially still have centuries to live even after halving her life span twice (though it is not clear how much she actually gained, given that human years and shinigami years might not work the same way and Gelus did spend quite some time watching her, assumably not killing many people).
Thought Misa is not known to be that rational. She simply wants to help/ please Light and assumes that, since she was that close to L for months, she would be able to see him again at some point. She probably planned on killing him right after meeting him the next time but that never happened.
Rem had stated several times, that she would do whatever it takes to protect Misa. She even agreed on killing L before the Yotsuba-arch because she did not care about Light and at that point and Light's life was the only one that would have been prolonged. Unfortunately, she never had the chance to see L before the incarceration of Misa and after comparing Light to Yotsuba-Kira, Rem grew fond of him and could no longer kill L without prolonging a human life that she wanted to protect.
After Misa regained her DN and started killing again, Rem realized that L would catch her at some point but Light would not waste the asset of Misa's Shinigami Eyes if L was dead. So the only thing Rem could do to protect Misa was to kill L and make sure that Light had all the advantages she could provide. Light prompted this reaction by talking about the possible punishment for Kira but I am sure that Rem would have come to the same conclusion anyway.
She never had the chance, somewhat by design
Rem deduces on our behalf in Chapter 57 that this is all part of Light's chessmaster plan coming to a head.
Light had arranged for Misa to regain a death note. Light's ideal situation would be for Misa to remember L's name, as that would let him proceed more cautiously, but he planned for the possibility she wouldn't remember it (Misa says it was just one in a horde of names she saw, as she didn't realize L's importance when she saw it). He also knew from Misa's absolute dedication to him that she would then immediately make the deal for the eyes in order to assist him more (even if she did remember L's name she can be expected to have done this, as there would be more people to deal with to realize Light's long term goals); this happens early in Chapter 56 with no prompting or orders from Light. Light intentionally keeps Misa separated from the team, L, and Rem to prevent an inopportune exposure. He meets with her outside of headquarters briefly, but otherwise she never comes in and he never leaves the premises.
But more to the point, Light knew that Misa, with all of her memories back, with the power of the eyes, and having resumed using the Death Note to kill after the team was already made aware of Death Notes, would quickly draw L's and the team's attention and be outed, imprisoned, and ultimately executed (and likely Light himself, too). L himself tells Rem as much, and Rem ultimately concludes that even if she reveals the whole truth that Misa will still be guilty of too much to be left alive. And Misa may have been more clever than Light originally gave her credit for, but she wasn't up to the task of putting things past L when he already had so many pieces of the puzzle, and Light having arranged things to point directly at Misa. But even more to the point than that, Light knew that Rem would know that, and that Rem was absolutely dedicated to Misa. So Light knew that Rem would have to take action to protect Misa. Being visible to the entire team and having no real ability to physically interact with the world beyond dropping a Death Note, this left Rem with the singular choice: kill L (and Watari) to save Misa's life. She might have written in Light's name as well, other than that Rem knew that Misa's obsession was so strong that she would almost certainly kill herself if Light died, which would defeat the point of saving her.
You can see more details in this Q&A about why Rem killed them.
And this was also part of Light's plan: Rem would then die, having expressly acted to extend Misa's life, and a Shinigami that didn't like him and would prefer to work against him, and had directly threatened to kill Light if he hurt Misa (keep in mind, this sequence of events all unfolded by Misa's own choices; she was not ordered to make the deal at any point) would be eliminated.