Include general info of your system setup (soundcard, MIDI device, Win version, how do you route MIDI, etc). It can be done in many ways deppends on your setup.
So you have M-Audio USB MIDI interface and Triton synth...
USB MIDI out to Triton MIDI in.
Triton audio out to soundcard audio Line in.
Arm audio track in sonar, set input from your Line in, solo mentioned MIDI track if necessary (otherwise you can record all MIDI into one audio track at once, but that's more difficult to mix later), hit record.
The idea is to have sonar plays the MIDI thru Triton, and also record audio from triton. Hope it helps.