Method to wrte obj file