A exam is in order. Older dogs heart valves deteriorate ( among other things like cardiomyopathy) and can cause fluid build up in the lungs which in turn causes a cough. This can often be treated successfully with medication. Another possibility are the usual…IE Kennel cough, or Collapsing Trachea ( more of a honking cough).
I worked for a Veterinary Cardiologist and have seen many dogs with heart disease do well with meds. If your vet thinks it could be heart related, please
see a board certified Veterinary Cardiologist. If this is too costly, ask about a payment plan.