Bathroom ventilation codes require a bathroom exhaust fan to vent to the exterior not the attic for health and structural reasons.
Bathroom exaust into attic.
No you cannot vent your bathroom exhaust fan into the attic.
When venting a bathroom exhaust fan make sure to vent the air to the outside rather than into your attic where it can cause mold and mildew to form.
So can you vent a bathroom exhaust fan into the attic.
Bathroom fan vent code requirements include no venting to attic areas to help reduce mold or structural problems.
You should never exhaust the bathroom fan directly into the attic.
Your attic is not a temperature controlled environment is never the same temperature as your living space and generally closer to the temperature outside.