year
is the year of the bar the script is running on. year(timenow)
is the current year. What was happening is that you were drawing a line on each bar using that bar's year, month and day, and garbage collection was only keeping the last ones. Only 2 showed but there were many more, superimposed.
This code only creates a line on the dataset's first bar and then only modifies it when the script reaches the last bar, so it uses that bar's date:
//@version=4
study("FutureLine", overlay=true)
level1 = 3050
start = timestamp(year,month,dayofmonth,08,30)
stop = timestamp(year,month,dayofmonth,13,30)
var line ln = line.new(start, level1, stop, level1, xloc=xloc.bar_time)
if barstate.islast
line.set_x1(ln, start)
line.set_x2(ln, stop)
It's more efficient to modify an existing line than to delete and create a new one, which is what would be required to keep only the last one.