You can buy a ticket before your visa has been confirmed. However, most embassies don`t require purchasing a ticket for a visa application, providing a ticket reservation among the documents should be enough. In some cases, you might be asked to purchase the booked ticket at the further stages. Make sure to read the ticket's refund conditions in the event your visa application is not successful.