Capture as Recording ⇧R
Save the most recently “played” MIDI events as a region. Pretty nifty.
Capture most recent MIDI performance in Logic Pro – Apple Support
It’s possible to capture your most recent MIDI performance, even if Logic Pro isn’t recording using the Capture Recording feature. You can use Capture Recording whether in playback mode or stopped.
When Cycle mode is off, Capture Recording creates a region containing all the MIDI events received during playback. In Cycle mode, you can use Capture Recording to create a new take region for each new cycle during which MIDI events are received when you have the Overlapping MIDI Regions preference set to “Create Take Folder.”