For this sort of thing, Psychtoolbox is your friend. I don’t have experience with it, but it is a MATLAB toolbox perfectly designed for full screen visual stimuli.
The toolbox contains an existing example called ‘moving line demo‘:
MovingLineDemo([xv=10][, twolines=0][, screenid=max])
Shows a pair of vertical lines, or a single line, which travel
horizontally across the display from the left to the right, repeating
infinitely.
See if you can edit this to suit your need; if you get stuck, come back to ask a more specific question!