In plugdata, use one of the MIDI IN objects and route MIDI data from it (see example).
Play notes on this MIDI track using any usual method — keyboard, piano roll, etc.
MIDI OUT
Add a new Software Instrument track. Load an instrument to which you want to send MIDI data (a).
In the Mixer view (press X to toggle), add plugdata-midi Audio Unit plugin as a MIDI FX (b). Alternatively, use the Inspector view (press I to toggle).
In plugdata, use one of the objects that sends out MIDI data (see examples)
FX
Add plugdata-fx as an Audio FX to an audio or MIDI track.
In plugdata, use [adc~] object to receive audio from your DAW (see examples).