2007 Scion xB shudders at idle

To begin with my car used to be a moving company’s card so it sat in a junkyard who knows how many years. The car is a great car! Good gas mileage, very roomy. Our first trip to get it fixed started with the tires, then led to a new battery, got filters cleaned out, but the last problem left is when idling at a light. The car shudders and turns off shows the battery light and everything else. What could this problem be?

I don’t want to buy anything if this is what I’m getting into, I just want to know if anybody out there would know the issue or could guess

Maybe the alternator is not doing its job. Get the entire charging system tested.