The thing to do is to base this on the DOG'S needs and not your daughter's, the 2 nephews', or anyone else's. This dog has had 2 homes, and isn't adjusting perfectly - who can blame it? Dogs are work work work - a lot of people choose them for the companionship they will offer and don't understand the work involved, as you yourself have experienced. Many of us who grew up with dogs don't remember how much training our parents did. It's not much different than people who think it will be wonderful to have a baby who will love them - and then they realize there's the child care involved!
Have you crate-trained this dog? From your SWH, it looks like you have not. Or is it loose at night and therefore able to leave "surprises" for you? And yes, dogs have to go out late at night. Little dogs sometimes can be trained on pee-pee pads so their little bladders don't have to hold all night, but in just a few months and after being removed from its owner/home, it might be too soon to expect this dog to know everything it's supposed to do. Moreover, since you state this is a little dog, it's important to realize that you cannot let most dogs out in the yard, particularly if they are small. You live in Massachusetts like I do, and we have coyotes all over the place - so little dogs cannot be unattended at all, even in a fenced yard or on a run. As any dog officer about this.
The dog needs to go to someone who will make this the dog's "forever home" - no questions, no maybe's, no excuses. This needs to be a person or a family who is skilled in dog training. It needs to be a family who is home a good part of the day. Most dogs cannot be crated 8 hours a day, and most certainly not a dog who has lost its home and family twice (as this dog will have when it is re-homed.)
We own a dog who was abandoned twice (not counting a pound, a shelter and a foster home), and believe me, it took quite a while to get her to trust us, to feel comfortable, to know what was expected (because we had to teach her as well as un-teach her the old ways!) We filled out a 6-page application (I'm not kidding) in which we were asked if we knew how much it cost to own a dog, where the dog would sleep, what we would do if we moved to a place that didn't take dogs, what we would do on vacations, what areas the dog would not be allowed in, and all kinds of questions to ensure that we knew exactly what we were getting into. We were chosen over prior applicants precisely because we gave detailed answers to these questions.
I would try to re-home this dog to a family skilled in training, who is home during the day (either an attentive SAHM or a work-at-home family), and who have the financial resources to invest in a trainer as well as some necessary in-home care so this dog is not left ever again. It is unlikely that this dog, for example, can be sent to a kennel during a family vacation, so it needs to go on vacation with the family or have in-home dog sitting including overnight (someone staying in the house). There is considerable stress on the dog already, and adding to it by re-homing it will make it harder for the next family to train the dog and earn its trust. These are traumatic events for animals and need to be treated as such.
I understand your desire to shield your daughter from trauma and I know that you feel terrible about this situation from everyone's point of view. But honestly, your daughter will recover much more quickly than the dog will. And anytime we get a pet, we need to think through what we will do if the animal (cat, dog, bird, fish) doesn't live beyond the years when the child leaves home -- which is likely. We need to think about death as well as possible re-homing. So when we get a pet of any sort, we know our children will lose that animal at some point. We must assume there will be loss at some point.
From your daughter's standpoint, it may be better to let her know that the dog is going to a home with a yard, that owning a pet is a lot of work, and that you did it to help out a sick friend but it wasn't the best decision. Sometimes letting a kid know that a mistake was made (even when made in good faith) is the best lesson in growing up. It can help her learn the process of thinking about others more than herself - that's a tough lesson for kids (and anyone) but it's a good one.