It may be that the dog licked himself after spraying the medicine and then stimulated the dog's stomach to vomit. The puppy's stomach is fragile, so it's best to pay more attention not to let the dog lick it when taking medicine.
Your dog has a fungal infection. It is best to buy a bottle of dog fungal serum for fungal infection. This is milder and more effective.