You'd better write down your thoughts.

Literal

Your thoughts [object-を] write-down [in advance-ておいた] [better-方がよい].

書き留めておいた方がよい combines three layers: 書き留める ('write down'), ~ておく ('do in advance'), ~た方がいい ('had better'). A practical piece of advice.