The long and short of it is that a vent fan, whether for a bathroom, a range hood or a clothes dryer, is normally removing very humid air from the room. If that air is not exhausted beyond the waterproof "skin" of your house (up through the roof beyond the shingles, or out the side of the house beyond the siding or brick), then you are not removing the moisture, you're just hiding it.
On top of that, your attic is a "cold zone"; it is not insulated or climate controlled and is generally the same temperature as the outside. So, in colder weather, the moisture in the air will precipitate out. It doesn't have to be anywhere near freezing for this to happen; just cool enough that the air being vented, when cooled to outdoor temperatures, falls below its "dewpoint" and can't hold that amount of moisture.
The end result is that it will literally "rain" inside your attic; condensation will form on the wood rafters and sheathing, and that's an open door to mold (especially considering your bathroom's already a breeding ground for all sorts of nasties that can hitch a ride out the vent fan). In just a couple of years, the mould could make your house unlivable, and your rafters will be rotting until the next severe weather could collapse the entire roof.
So, it is required by code in virtually all jurisdictions that ventilation fans terminate in a vent cap on the outside of the building. There should be no leaks in the vent line that could allow the humid air to escape into an interior space. Bringing the vent to an existing attic vent isn't enough, because the air can still mix before it leaves the space and form condensation. You must either seal the vent line to that roof vent (which would also require you to have enough roof vents that the attic can still "breathe" with the loss of the one you sealed up), or cut a new hole through the roof for a new vent cap.