Just for me personally, I never try and force myself to write music when I don't want to. There's really no point to it, cause I'm almost never happy with what I write. And when I force myself to write, it makes me like music less in general, which makes me less motivated overall. I think it's best to write as much as you can only while you're motivated. It'll make you like making music more, and you'll perpetually become more and more motivated. At least, that's been my experience.