Edit macros are simple REXX or CLIST programs that are stored in an TSO library (SYSPROC?). They are called from the Command Line while in EDIT or VIEW or can be run by default based on panel or EDIT PROFILE settings.
I suggest you read the manual ISPF EDIT and EDIT Macros. There are probably examples there to get you started.
Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.