Two possible approaches
1.Create the formula as a text value and then convert to a real formula, e.g. put this formula in B1 and copy down as far as you need
="=MEDIAN(A"&ROWS(B$1:B1)*8-7&":A"&ROWS(B$1:B1)*8&")"
Now convert to text by doing this
Copy column B then right click and use Paste Special > Values > OK
Now convert to a formula by doing this
Select column B and use Data > Text to columns > Finish
2.Use this formula in B1 copied down
=MEDIAN(OFFSET(A$1,ROWS(B$1:B1)*8-8,0,8))
The first method is a little more complex but you end up with the exact MEDIAN formulas you wanted. The second approach is simpler and gives the correct results but it's not obvious, looking at the formulas, what each one is doing