It can take many shapes at the end of organ improvisation and its function is simply either to remind the listeners of the themes heard in the improvisation or to provide a sense of completion.
I found that one of the simplest (and quite satisfactory) solutions for structuring a Coda is this:
1. Short excursion to the key of subdominant (tonic pedal point in the pedals): D7 of IV and IV (iv in minor).
2. Repetition of Step 1 one octave lower or higher.
3. Return to the tonic by diminished VII7 and I or i in minor (still with the tonic pedal point).
4. Repetition of Step 3 from different pitch level of diminished VII7 (VII, II, IV, VI- in the top voice or VII+, II, IV, VI in minor).
5. Several repeated tonic chords. It might include different scale degrees (I, III or V) in the top voice.
Try this approach in your improvisation or composition. It's not very difficult to do but I'm sure you will enjoy it. Here is my example.