Omg , im so sorry for your loss
It does sound like she was already sick when you bought her.
Like others have said scrub and disinfect everything, including the new cage before you bring your new one home. Throw away anything you cannot.
Weigh your new bird daily before he has anything to eat so you know if there is something wrong.
Same with food, weigh it before you feed it and weigh it again after meal time/at the end of the day and remove it for the night so you can tell how much food has been eaten.
This might seem like a lot of faft but believe me is really can tell you alot about your birds health. Harlie started eating very very little a few weeks ago (about 2g), because I weigh her food I knew the same day she stopped eating as much and I knew the day after that it was not a one off, we got meds for her on the second day and now she is back to eating enough again.