Macros behave the same as spells from the spellbook cast on the macro's end target. Which means if you use a cure macro whose end target is an enemy, you end up self-casting, just like you would with a raw ability with an enemy targeted.

With the way your macro is set up, if your target is a friendly, in range, in line of sight, curable (e.g. not raise-locked), you'll cure them.

If your target is hostile, you'll cure yourself, and your macro will never get to lines 2 or 3, because a cure cast on an enemy means self-cast cure.

If your target is friendly, but out of range or LOS or not curable, and they have no target, the first two lines get skipped and you cure yourself on line 3.

If your target is friendly, but out of range or LOS or not curable, and their target is hostile (and in range, in LOS, etc.), the first line is skipped and you'll cure yourself on line 2, because you're casting cure on an enemy on that line.

There's really no way to combine <t> and <tt> successfully for cures. You can pick one and stick with it as long as you're aware of what you're targeting, but putting the two together basically dooms you to self-casting anytime you're not absolutely aware of the targeting situation.