An upper respiratory infection usually clears up in about a week. The medicines the vet put your pup on are 1) an antibiotic to clear the infection and 2) a cough suppressant so that further damage is not done to the mucus membranes which would prolong the coughing symptoms.
Until he is back to normal, avoid using a collar and switch to a harness that doesn't push against his trachea--Yorkies should be on harnesses anyways. Restricting activity until he is fully recovered is a good idea too.
Congrats on your new puppy and welcome to YT!
Ps. When your pup goes in for vaccinations make sure they do the actual Bordetella vaccine, not the nasal injection.