If you wish to transpose this riff into the key of A (using A ( I ), D ( IV ) and E ( V ) chords), start the riff on the A note (5th fret of the 4th string) and change to the D and E sections accordingly.
To transpose the riff into the key of C (using the C ( I ), F ( IV ) and G ( V ) chords), start the riff on the C note at the 8th fret of the 4th string. For the F chord, start on the 8th fret of the 3rd string and for the G chord start on the 10th fret of the 3rd string.