The Z pack itself is safe, but it only works if your secondary infection was bacterial and it was a bacteria that would respond effectively to the class of antibiotics that Z pack falls under. Sometimes the infections you get after you get sick with something else are bacterial and are sensitive enough for azithromycin to work, and sometimes they aren't. What you might have could just be viral (most infections are viral actually) or it might not be something that the Z pack is able to treat or you just might need longer to start feeling better.
I wouldn't take another course of it though without getting checked by your doctor first. If it didn't work the first time, it wouldn't work if you took it again. Actually, lots of bacteria is now resistant to the Z pack anyway because doctors prescribe it so often. You probably either need a different class of antibiotics altogether or you just need to wait it out and give it more time to get better. It's not quite the same thing, but I had pneumonia a few years ago and was on antibiotics for 2 weeks. But I still felt sick for another two months after that before the infection totally cleared out of my lungs even though technically I'd killed off all the bacteria that was causing it.
Antibiotics, especially if you're really sick, can kill off enough of the infection to help your body get a handle on things, but it doesn't mean you'll feel totally fine right away. It could take a week or several weeks or longer depending on whatever the original infection was until you feel back to normal. If you still feel crappy though, I'd see your doctor again to follow-up.