First, before I answer your question, know that it’s okay. Thoughts come and go during meditation, just as they do during other activities. No problem. Don’t listen to anyone telling you that you’re not doing it right. That’s nonsense.
Second, before I answer your question, it’s important to notice what’s happening in your mind. Where does the thought come from? Have you investigated that?
Where, really, does any thought come from?
How does it arise?
And where will it go?
To where?
Are you afraid that, if you don’t get up and write it down, it will be gone forever? Really, where will the thought go? Is it not you, talking to yourself, creating a thought, which your conscious mind can now hear because you are quiet enough to listen?
Third, before I answer your question, let’s examine the sensation that urges you to get up. Isn’t this urge do something very similar to any other internal or external stimuli that you, ordinarily, compulsively, reflexively, react to? Like an itch? Like a shift in your position when you feel discomfort/tension in your knee/low back/shoulder?
Now, to answer your question, you can scratch the itch, you can shift your position. Scratching can be very satisfying; shifting can bring necessary relief to an uncomfortable pain. You can get up and write down a thought. You can do so. It is allowed!
Now, knowing this, you may decide that whatever impulse you felt to get up or scratch or shift or otherwise do something, is not actually worth reacting to. You may even enjoy ignoring the impulse and continuing to sit still. I don’t want to tell you too much about the outcomes though. Otherwise, you may try to focus on my words, rather than figuring out the rest for yourself.