You just need to understand two things to write out all twelve diatonic major scales: 1) The space pattern between notes (structure) and 2) How sharps (#) and flats (b) control those spaces.