I am trying to write a message in pd with a curly braces {  } to build some lilypond syntax but
I got the message " keycode 123: dropped
"

Meanwhile as I guess lilypond syntax will be used in non-real time context, you could work around this by marking- up the braces you need for the lilypond syntax and then pass the created file through a script which "corrects" it.

Lorenzo