1. I kept a diary last night.

2. I wrote a diary last night.
3. I wrote up a diary last night.
4. I wrote in a diary last night.
==============
Which expressions are right? Are they the same in meaning?

Only #4 is correct.

Here are some variations that would make the others correct:
I kept a diary during my teenage years.
I wrote in my diary last night.
I wrote three diary entries last week.