One way to create a macro is to record it.
Start recording a macro and save it to a register (in this example, we'll use a, but it can be any register you could normally yank text to):
qa
Then run the commands you want to record in the macro (here, we'll surround the contents of a line with <...