1. A method of generating a writing pattern which generates, from pattern data, writing pattern data to write a mask pattern in a photomask used in an exposure tool comprising a projection optical system to transfer the mask pattern to a resist film formed on a substrate to form a latent image, an immersion mechanism which forms a liquid film in a local region including a region between the last element of the projection optical system and the resist film, and a movement mechanism which moves the substrate with respect to the projection optical system and the immersion mechanism to transfer the mask pattern to a plurality of unit exposure regions set in the resist film, the method comprising: obtaining a typical distribution of contact history values between the resist film and the liquid film in the unit exposure region; dividing a pattern which corresponds to the pattern data into a plurality of regions according to the typical distribution of the contact history values; and carrying out correction of a pattern included in each of the divided regions under a rule according to the contact history values.