Does one need to be affiliated with a university to publish papers?
Absolutely not. Affiliations do not matter; what matters is the value and the fit of the contribution to the journal or the conference to which you are submitting.