I'm trying to make a macro so that I can dps while targeting the tank

If this is your main reason for wanting to use macros, I suggest focus targeting the opponent/boss (hell, even if you're not dpsing, I'll STILL suggest using focus target, just to be aware of what spell is the boss casting etc).

the macro itself:
/ac "attack spell" <t>
/ac "attack spell" <f>

if you're main targeting your tank, and your focus target is a monster, once you press this macro, the 1st line /ac "attack spell" <t> will fail, since your <t> is a friendly unit, it will then attempt to execute 2nd line, and since your focus target is a monster (AKA valid target for attack spells), the attack will be executed.

The 1st line /ac "attack spell" <t> is more for general content like FATES etc, without it, you'll need to focus target every time a mob dies.