Welcome to Healthcare magic.
castor oil can cause cramping in your 6 year old daughter.
She is already on lactitol
which is a good laxative.
Since she is still passing hard stools, you can either ask her doctor to adjust the dose of lactitol for better evacuation or ask him to add a stool softener
As an other option, she can take Polyethylene glycol
which both softens the stool and evacuates the bowel and is very safe too