The two goals you have are not possible to achieve as a MIDI adapter cable.
The MIDI adapter cables have a digital protocol with information such as note on / off with notes, speed, etc., patch changes etc. No analog waveforms or other representations of actual sounds are transmitted over MIDI.
Therefore, it is not possible to transmit actual sounds from Garageband to the keyboard speakers – and likewise record the sounds from the keyboard to a Garageband audio track is also not possible.
If you want to achieve these goals, instead you need to buy analog audio cables and an audio recording interface for the iPad – or use the 3.5 "input (not so good). [1
Likewise, you can record MIDI notes from the keyboard into an instrument track in a MIDI compatible app But when you play it back, the sound comes out through the keyboard's speakers – and the keyboard needs to be connected to play the track.
Alternatively, you can use GarageBand with a virtual instrument that will make instrument sound from the MIDI notes and play it back through the iPad speakers.