Should I write a recommendation letter for a student at a previous job/institution?
When you change job, you don’t erase your memory (well, not in all jobs), nor do you all your responsibilities related to this previous job vanish. It is true that leaving a position creates certain obligations in the data you can retain, and how you can use non-publicly available information pertaining to your older institution. However, in the particular case of a reference letter, I don't think it should cause trouble. Moreover, reference letters are confidential.

Actually, I'd go further than saying it should not be a problem. In fact, I think if you can honestly write him a good recommendation letter, it is part of your responsibility to do it. This responsibility is not to your former institution, but to the student and the academic system as a whole.