MIDI sound is not really sound. It is a digital representation of the notes you are playing. An application like GarageBand knows how to interpret this MIDI stream and produce sound on your computer.
I don't know an application that could at once interpret the MIDI stream and record it as actual sound (like in a WAV, AIFF or AAC file) on the fly.
You could do the following:
0) Install BlackHole Audio Driver - this will let you record the audio output from one application as input to another.
1) In Audio Midi Setup, create a new "Multi-output device", and include in it the mac speakers (or headphones if you prefer) AND BlackHole Audio.
2) Have GarageBand and Quicktime Player running.
2a) Set Sound output to be the Multi-output device created in the previous step. This is so you can hear the sound and record it at the same time, without any external sound being recorded as well
3) Start a new Movie recording in Quicktime Player; make sure that the "mic" input for the recording is set to BlackHole and (if necessary) bring GarageBand to the front (not sure if it will playback while in the background).