The only thing you are doing wrong is expecting OmniGraffle to emit working Applescript code :-)
The first line needs to be
Code:
tell application "OmniGraffle Professional 5"
and if you make an intermediate stop in a text editor to fix that, I think you'll find that
pbpaste | osascript - will work.