If you first propagate the slope to all subsequent missing values, you can easily calculate the 'fit' values step by step, just adding the slope to the previous value cumulatively:
df['slope'] = df.slope.fillna(method='ffill')fit = df.avg.values.copy()missing = df.avg.isna()for i in range(len(df)): if missing[i]: fit[i] = fit[i - 1] + df.slope[i]df['fit'] = fit