If you write music in the key of - say - F#major, the seventh note of the scale is E#/F natural. This is noted as E# because the reading is easier. There would be both the seventh and eighth notes of the scale sharing the same line if E# were not used, with accidentals all over the place and nothing on the E line or space.
Stu