Dear Mr/Ms xxxx,
Thank you for your letter of [date], informing me that the position has been filled, and that you will keep my name on file in case it comes vacant in the future.
While I am sorry to have missed this chance, I shall look forward to hearing from you if the post is available.
Many thanks for considering me.
- For Teachers