Creating a variable is pretty easy. First, open the 'Trigger Editor' (it's the button with an "a" on it). At the top of this is another button, with an "x" on it - click that to open the variable editor.
There, click the green x+ to create a new variable. Give it a useful name (eg, AttackingKnight) and for the type, select 'Unit'. Click OK and you've got your variable!
However, this variable is currently empty (ie, it doesn't refer to any specific unit). A variable is basically a name you give to something that you can then refer back to later in other triggers etc. You've created the name, but you haven't given it to anyone yet.
To give that name to a unit, you need to use the trigger Action called 'Set Variable' - select that action, and then select the Variable you want to set, followed by the unit you want to use that Variable for. Done! Once that trigger runs in your map, the selected unit will be associated with that Variable.