Your interpolation is basically based on two points (x0,y0) and (x1,y1),
All you can generate with this info is a linear interpolation.
You can not generate a cubic interpolation, without further knowledge of the slopes (dy/dx) at these two points.
You are using 3 shape functions, based on “t”; the spacing of x between x0 and x1.
This formula is basically:
yt = y0 * Shape0(t) + y1 * Shape1(t) + dy * shape01(t).
Unfortunately, any cubic interpoplation is based on the suitability of the 3 shape functions to dy/dx at the two end points.
shape01(t) must be related to the end slopes, not assumed.
If you plot your Shape0(t), Shape1(t) and shape01(t) functions in Excel, you can identify how shape01(t) is a particular solution for dy/dx at the 2 end points, rather than a general solution.
You need to provide (x,y, dy/dx) at 2 points to achieve cubic interpolation, which supplies estimates of dy/dx at the 2 points you are using.
Try Google, rather than ChatGPT
Alternatively, there must be a 4-point Lagrange interpolation formula for non even spacing of xi