Thank you for your query,
It seems you child developed a tear in the rectal mucosal layer or a fissure due to having constipated.
That may be the reason for her refusal to go to toilet and crying while passing stool.
You can give stool softener
like oral lactulose
once or twice daily as per your Pediatrician
advise to make stool soft.
Give plenty of oral fluids, water to maintain hydration.
Give dietary fiber
rich foods like vegetables and fruits.
Hope I have answered your query.