I agree with Kent's advice on the Toledo tickets. You needn't rush, and you won't save any money by buying early, but you don't want to get marooned in Toledo if you've paid for a hotel room in Madrid, so I would buy the tickets ahead of time unless I was waiting to see what the weather was going to be like or something like that.
It appears ALSA has bus service from Nerja to Granada six times a day on weekdays in late June. Most of the trips are scheduled to take between 1:50 and 2:30. I have taken quite a few ALSA buses, and they are comfortable.
You do not under any circumstances want to buy the tickets to Seville at a staffed counter at Madrid's Atocha Station. I spent 3 hours in line there back in April. The vending machines are fine if they like your credit card and you are not using Tarjeta Doradas (senior discount cards). But you won't know about the credit card situation until you get there--too big a risk. Buy the tickets in advance (which may get you a discount if you're sure of your schedule and buy nonrefundable tickets). Loco2.com is easier to use than the Renfe website.
I don't think I've ever needed to buy a ticket at the Seville train station, so I don't know whether there's a risk of horrible waits there as one encounters in Madrid. If your schedule is firm, I'd buy the tickets to Cordoba and Malaga now. You may save some money, and I have definitely seen AVE trains sell out.
As I believe you know, Nerja has no train service. ALSA has frequent buses from Malaga.