Firstly, can the people incorrectly and unhelpfully suggesting shaming or punishing this poor kid please sod off. Those strategies will make things worse.
Secondly, she isn't doing this on purpose. Whether she is constipated or not (99% of them in this situation are) her brain is no longer receiving/ correctly interpreting the signals of the need to poo.
Thirdly, if she isn't going to the toilet to poo, then there's nowhere else for it to go but her pants.
If she is constipated (and children can accidentally make themselves constipated by withholding) then the last part of her gut, the rectum, which is normally a squeezy stretchy hosepipe sitting empty waiting for poo to come along, gets full of poo, which stretches it, and impairs both it's ability to push, and also the ability to feel when is a good time to push. So they can't tell when some poo is about to want to come out. In the meantime, the poo sitting on the bum hole, pressing, dilates up the anus (like with the head pressing on the cervix in labour) , meaning that poo leaks out more easily. In the meantime, there's still food and drink going into the top end, which is digested into liquid poo which hasn't yet had all the water sucked out by the colon. If more liquid poo hits the top of the backlog of harder rocks of poo, it tends to find nooks and crannies to sneak past, coming out as overflow diarrhoea. The idea behind movicol is it hangs onto water, keeps it in the gut, and gradually dissolves the old poo. The disimpaction regime is intended to get rid of all of the old poo, which absolutely requires giving the child diarrhoea.
Clear out tends to need a good 3 days of stools like gravy, in vast quantities. Going straight to diarrhoea suggests significant constipation, and that you've just loosened things up enough to get overflow. Once the rectum is emptied out, it's still big and stretched up and flabby, so the next step is to use a smaller dose of movicol to keep the stools soft and squidgy and coming out every day, so the rectum can slowly shrink and heal and regain function.
At present she doesn't have a clue when her body needs to poo. So you need a routine. She needs to sit on the toilet for 5 minutes after meals, and also if you spot body language that she's ready to poo, take her then. Praise/ reward for going to the bathroom without arguing and trying. Once the poos start going in the toilet, then you can move on to rewarding for that. Then for going to the toilet without you telling her. Only think about rewarding for clean knickers when it's something she has a fighting chance of achieving. If she isn't making good progress once definitely not constipated, then it can be worth trying a small dose of a pushing agent like senna to encourage her to develop a pattern of pooing at a particular time of day.
These problems are more common in young people with autism, so worth a think about if she has anything else to suggest it, and maybe a chat with school. Abuse is occasionally a cause, and people are just mentioning it in case it makes anything go ping for you.
This is eminently sortable, but you do need help, so definitely back to the GP for a referral to either the continence team, or a paediatrician, depending who covers it in your area. Good luck. You can do this.