The defect structure of the GaN film grown on sapphire by plasma-assisted molecular beam epitaxy (PAMBE) technique was found to be dependent on the AlN buffer layer growth temperature. This buffer growth temperature controlled the defect density in GaN film but had shown contrary effects on the density of screw threading dislocation (TD) and edge TD. The density of screw TD was high on lower temperature buffer but low on the higher temperature buffer. Meanwhile the density of edge TD had shown the opposite. Further examinations have suggested that the defect structure was closely related to the stress in the GaN film, which can be controlled by the growth temperature of the AlN buffer. Using the 525°C AlN buffer, optimum quality GaN film with relatively low screw and edge TDs were achieved.