First:
Make a audiotrack in Sonar, make the right settings regarding your soundcard, to be sure that the audio side of Sonar is working.
Try to load a wave into sonar and see if it plays thru your monitors. If it does, you can be pretty much sure that this aspect of Sonar is working.
Arm the audiotrack, the level meter should now be senzible to an incoming audiosignal. If your motif's audio outputs are connected to the line in of your soundcard, I suggest you to start a demo song (there is sure one inside of the motif). The level meters in sonars record-armed audiotrack should react now. If not then there is a problem with the soundcard settings.
If they react and you see an incoming audiosignal, you are able to record it.
Now for the midi connections. This is the only way it should be done:
Your keystation is connected to your computer via usb. In sonar on a miditrack your keystation should appear on the inputs with a name. This means that sonar is recognising your midicontroller as an appropriate midi device and that sonar will record any incoming midi instruction. Look under the options menu and make the right settings about your mididevices in the midi menu (move your keystation device to top - this is an option)
The important part is that you should connect the midi out of your soundcard to midi in of your motif!
This is very important. The rest is simple: on a miditrack as your input device select the keystation, as an output device select your soundcard. Sonar will route the incoming midisignals directly to your motif via the midi out of your soundcard.
How to record midi to audio was explained earlier in this topic.
I have my Keystation's MIDI OUT running into my Motif's MIDI IN and also I have my Keystation connected directly to my computer with a USB cord.
Wrong and unnecessary, because there is no direct connection between sonar and your motif. In your way it maybe works if sonar sends midi back to the Keystation and the keystation puts the incoming signal further to its midioutput (where motif is connected. This would be a kind of an echofunction. The manual probably explains it. See my post above about the midiconnection.
Then I have my Motif's MIDI OUT into my sound card's MIDI IN
This is also wrong. You have a soundmodule. It is there to produce the sound that you hear and that you will record as audio. The midi is actually recorded from your keystation.
and also I have my Motif directly connected to my computer with a USB cord
You don't have to fill every hole
. The usb connection on the motif serves as a midi output. Disconnect it because the motif should not send any mididata to sonar.
Then, my Motif's L/R Outputs are connected into my soundcard's L/R Inputs. Then my monitors are running through my soundcards L/R Outputs. And just to let you know my soundcard is an EMU 1212m.
Well done, this is the only right connection in your setup!
Above all, try to get some knowledge about midi, what it does and the basics about the connections. Connecting every output and input without knowing what it does is missleading.