At a university, I distribute all of my old exams for a course to each year’s class. (This works because the courses I teach change every few years.). This tends to eliminate the advantage when some students might have access to old exams (thanks to a friend or sibling), and others would not.
At the local high school, the teachers refused to return any tests or exams long enough so that the students could take them home. Thus the parents tended to have no idea what the student got or missed on the exam. This let the teachers use the same tests and exams every year, but I don’t think it was particularly good pedagogy.
I see no problem with looking on the internet for example problems, even if some of them later wind up on a test or exam. In my view, it would be different if the questions were behind a pay-wall, or if you had to certify that you were a course instructor before accessing the files.
In a STEM course, a teacher who uses questions taken from the internet could change the numbers in quantitative questions, or provide different “knowns” in an equation to generate a different “unknown.” Then it’s a matter of whether you understand how to solve a problem or not. In history or literature, there are so many possible questions that it would be impractical for a student to simply memorize the answers to online questions (at least, in my view).
So I think what you are doing is fine.