Watch the Twists and Turns online guitar lesson by Jon Finn from 30 Melodic Modal Rock Licks You MUST Know
Sometimes when I practice, I like to write licks by working things out very slowly, sometimes taking notes on paper. The idea is to encourage myself to try things that are less "guitaristic". For this one, I just wrote down notes that I thought sounded good with the chord, one at a time.
Because the progression is in E, I was able to use open E and B strings in unusual places within the phrase as a way of connecting positions. Practice this very slowly at first. Pay a lot of attention to rhythms and timing. Check the video and the notation for details.