This is a classic guitar exercise - playing diatonic 3rds through a given scale. Click here for the sheet music, tablature and a MIDI file of the exercise.
You can drop the MIDI file in a DAW on an instrument track, loop the selection and play along. Once you get it down, you can gradually increase the speed to improve your chops.
The proper form for this exercise is that all 7th fret notes are played with your first finger, all 8th fret notes with your 2nd finger, all 9th fret notes with your 3rd finger, and all tenth fret notes with your 4th finger. Follow that exactly and you'll play it right
Tip - if you drop the MIDI file in your DAW and it sounds an octave too high, this is because guitar and bass music is transposed and sounds an octave lower than it is written, so just transpose the MIDI file down an octave and you're good to go!
Have fun!