It's a vicious cycle of hard stool, pain and then child facing difficulty and having bad experience. This cycle continues. V need to break this cycle by multiple measures like dietary changes and medications for 2 weeks atleast to make stool soft and easier to pass.
Next Steps
stop milk based diet along with maida products and include fruits and vegetables in the diet with good hydration.
counceling and long term plan required.