Which particle do I use to say that something is written somewhere? I googled both versions and they have a similar number of hits. Can I use both? Is there a difference between the two?
There is a huge difference.
In this phrase 「ここに」 refers to "on what object you wrote something". It could be in a notebook, on the chalk board, on the wall, etc.
This talks about where the act of writing took place. In the library? On the bus? In a cafe?
Thus the two phrases are not interchangeable.