Once you start playing notes all over the fretboard, you quickly realize that you can find the same notes in more than one place. E.g., the E note which is the open first string can also be found at the 5th fret on the second string, the 9th fret on the third string and the 14th fret on the fourth string (on electric guitars it can also be found at the 19th fret on the fifth string). Once you are comfortable with all the locations of a note, it is easy to play the same melody in many different places on the fretboard. This is valuable when you are improvising or reading music. Practice naming any note and then finding it in as many places on the fretboard as possible. Keep doing this for a few minutes each day, until you are confident you can quickly find all the locations for any note.