How to get a model predict after test data and plot it

I was wondering how the model predict a new data after train data then test data finally plot it. (Which is in my opinion that process is curve fitting). If you know Ms Excel in chart section there is chart and curve fitting and then forecaat it)

shift train predictions for plotting

trainPredictPlot = numpy.empty_like(dataset)
trainPredictPlot[:, :] = numpy.nan
trainPredictPlot[look_back:len(trainPredict)+look_back, :] = trainPredict

shift test predictions for plotting

testPredictPlot = numpy.empty_like(dataset)
testPredictPlot[:, :] = numpy.nan
testPredictPlot[len(trainPredict)+(look_back*2)+1:len(dataset)-1, :] = testPredict

plot baseline and predictions


Let’s say the total data is 100, it splits into 80 for training and 20 for testing
It has done well in plotting
The question is how to get the forecast for data number 101 (single forecast) or multi forecast.
Many thank for the help

scipy provides functions for least-squares curve fitting and spline-based extrapolation. For more specialized curve fitting problems, the other functions in the scipy.optimize module may be useful.