Let me offer some corrections.
Before going to (the) bed, I have to update my diary first. (One doesn't finish a diary.)
When I was writing in my diary, a question came up.
I had learnt how to ride a bicycle when I was 18. (Yes, it was my 18th birthday then.)
Is it correct to write this?
The thing (i.e. being able to ride a bicycle) that I had learnt on my 18th birthday is useful to me?
You can use either "is" or "was". If it is still useful to you, I would use "is".
Student or Learner