I'm going down my street minding my own business whys should I then be harassed by a man so he gets his kicks?
How on earth do you think someone is getting "kicks" out of saying "Cheer up"? And how does it harass you for someone to say that?
She didn't like the comments, therefore making it unacceptable
The fact that someone doesn't like what another person says does not make it unacceptable. Your daughter can't even remember what he said, she can't be that bothered about it.
My daughter didn't even 'get' the joke
But it doesn't sound like it was meant to be a joke, just a friendly comment in passing. Maybe the entire problem is that both you and your daughter are trying to read something into it that just isn't there.
Nothing wrong with talking to children as long as the context is ok. He could have just said, hello are you ok, are you having a nice time playing. But no instead it's' don't get into trouble'. What's the point? No child will learn or get anything out of the comment he made
I think I'd be rather more worried about someone saying to strange children "Hello, are you OK? Are you having a nice time playing?" Because that would sound like an attempt to get into a conversation with them which might lead to more. But just a passing comment "Don't get into trouble" doesn't require any response from them, it's just a friendly comment of the type people make all day every day. No-one expects people to "learn" or get anything out of social chitchat.
I'm just stunned you could read so much into four short words and take so much offence from them.