Write something like:
Thank you for their time and effort interviewing you.
Thank you for their considering you as a candidate.
You wish you have chance to work with them in the future.
If anything change or other opportunity, please let you know.
You outsmart yourself in this way since I bet most candidate do not write the letter for rejection.
Well kept relationship will pay off.