Analysing where your potty training went wrong is not the answer here. Neither is force. The best way to deal with this situation is to use a gradual, step by step approach.
The first step is to stop your child from pooping in his or her underpants. That means training your child to go to the bathroom, and change into training pants when he or she feels a poo coming. If your child doesn’t, and you ‘catch them in the act’ take your child into the bathroom immediately. That way, your child becomes accustomed to that being the place where he or she poops.
Once you’ve managed to accomplish this, it’s time for the next step: letting your child poop in training pants, while sitting on the toilet. From there, it’s a short leap to realising that pooping in the toilet is the right idea, and your child should work it out by him or her self.
Patience, and reassuring your child that you believe that he or she will achieve what you want him or her to is key. You also want to rule out constipation, which can make having a bowel movement painful or uncomfortable, and is a major cause of children not wanting to use the toilet.