A little girl said something horrifying to a certain lady. Then the narrator wrote:
The lady only just restrained herself from saying,
Oh, you poor child! Some things were better left unsaid;
they underlined what should be skipped.
Does it mean she said "you, poor little child" or she didn't say that?
She didn't say it. She wanted to say it. She felt like saying it but she restrained herself. That means she stopped herself from saying it. By saying that she "only just restrained herself" that shows that she very nearly said it.