What does the Japanese word for "to write," 写, have to do with a magpie? An actual magpie, the bird.
Almost nothing, and that is exactly the lesson. The older form of the kanji is 寫: a roof (宀) with 舄 underneath. And 舄 was, originally, a drawing of a magpie. But inside 寫 the magpie is not there for its meaning. It is there purely for its sound, a phonetic tag and nothing more. The bird lent its sound to "write" and then flew off without leaving a single feather of meaning behind. The meaning comes from elsewhere. The old sense was to carry something in under a roof and set it down.
Carry a text over, and you copy it. Copy it, and you write it. It is also why a photograph is 写真, literally a truth carried over. This is the single most useful thing a beginner can learn about kanji. A huge share of them are built exactly like this: one part for the meaning, one part purely for the sound. Hunt for a reason the magpie "means" writing and you will tie yourself in knots, because it does not. Knowing which parts carry meaning and which are just sound is the real skill.