It should cast heal on a friendly target, and should cast lightning bolt on an enemy, but it does neither. It just says in party chat "harm, nodead lightning bolt.
I suspect that in the first macro, you’ve got a return character before the second line, so it’s interpreting it as a new line without a slash command in front of it. (Which will go to chat.) That’s why adding the slash command to the second line worked to fix it. However, it’s best macro practices to use only one command line for a single intended cast to avoid weirdness. Your first macro will work fine if you delete the carriage return.
As for the conditional order that Elvenbane mentioned, it depends on what you want to do. Your original macro doesn’t have a mouseover option for the enemy target. If you want a mouseover option for enemy targets, then use one of Elvenbane’s macros.