there are two reasons for writing a key signature. firstly, it saves writing out lots of sharps or flats during the piece. secondly, it helps the player to think in the key (music) of the piece. this helps to understand the music better.