Create an extension
The first step to create a hook is to create an extension.
I'd recommend installing civix which can generate an empty extension by simply typing the command :
civix generate:module myextension
Go check https://docs.civicrm.org/dev/en/latest/extensions/ for more details about extensions.
All you need to know for now is that civix will ...