No, it’s not okay to vent a bathroom fan directly into an attic. There’s excess moisture from a bathroom vent during cold weather which can build up frost on the underside of the roof sheathing. Eventually, this ice will melt and leak onto the insulation and drywall ceiling.