I have to keep a diary every day.

Literal

Every-day diary [object-を] keep must.

日記をつける ('to keep a diary') is a fixed collocation — つける here doesn't carry its usual meanings of 'attach' or 'turn on' but specifically means 'to write/keep' when paired with 日記. ~なければならない expresses obligation.