There are many different patterns for playing a major scale on the guitar. All will use the same formula of TTSTTTS (or WWhWWWh) - gaps between successive notes. The simplest one will start on one string, somewhere, and go progressively up that same string in the increments shown. It works, but is hardly practical.
Probably the most common uses all of the strings, and works across them. The way the guitar is tuned, it isn't too difficult. In fact, your hand doesn't have to move up or down the fretboard - it can stay in one position, while the fingers do the work.
Using one finger for each fret, and moving to the next string when needed: for A major - start on bottom string,on the 5th fret, using middle finger. Next note is 2 frets higher, so play it with pinky. Then play 5th string with index, then middle, then pinky.Next string (4) uses index, ring, then pinky. That's one octave.
On to 3rd string. Index, ring, pinky. Then 2nd string, only two notes here - middle, pinky. At the end, on top string, it's index then middle, for the final top A note.
All you've done is translate the TTSTTTS spacings across the strings. The beauty of it is that there are two octaves, and the hand hasn't needed to slide up down or anywhere. By placing that middle finger just about anywhere on the bottom string, and using exactly that pattern, you have all the major scales (yes, all 12) at hand, so to speak!