Sorry man, but for me it is unclear what you try to do. May be I am not alone and so you get no replies
In general, to record MIDI:
* you need it getting into computer. All devices should be connected before you start CbB and in case you want dis/re-connect something, exit CbB first (you can hit quite some bugs otherwise)
* enable required MIDI input in CbB preferences. Notice MIDI icon in the Windows system tray. When you press keys on MIDI keyboard your should see the left "led" blinking on it. If you do not have it blinking: exit CbB, locate "%APPDATA%\Cakewalk\Cakewalk Core\TTSSEQ.INI" and delete it. Start CbB and enable MIDI input device again.
* check you do not have anything in "Control Surfaces" section (temporarily clean it in case you need it in general). Also check "MIDI/Playback and Recording", "Notes", "Controller", "Pitch wheel" should be checked (enabled) there
* record arm a MIDI track, set its input to "All" or device in question, start recording and press some keys. You will get no sound, but clip should record noted. Check the result in the Piano roll
If you can record now:
* to used hardware synth, enable it as MIDI output and set MIDI track output to it. Enable "Echo" on the track.
* for VSTi, create "Simple instrument track" (in the dialog after you insert the synth), enable "Echo", check input. Note that without that dialog it is easy to create "disconnected" tracks/synthes (handy in some cases).
Also note that some devices which have USB and MIDI do not output MIDI throw MIDI connector in case USB is active.