This is a problem of basis functions choice to represent solution. The simplest basis in this case is {1,t,t^2,...,t^n} (Taylor series). We can restrict maximal power from the beginning as follows
nmax = 14; var = Table[t^n, {n, 0, nmax}];
h = 7/10; nn = 15; x[0] = t;
Do[
xs[n] = x[n] /. t -> s;
g[n] = D[xs[n], {s, 2}] + xs[n]^2 - s^4 - 2;
in1 = Integrate[s*g[n], s]; in2 = Integrate[g[n], s] - in1;
int1 = in1 /. s -> t; int2 = (in2 /. s -> 1) - (in2 /. s -> t);
xn = x[n] + h*(1 - t) int1 + h*t int2; lst = CoefficientList[xn, t];
x[n + 1] =
If[Length[lst] < Length[var], xn, Take[lst, Length[var]] . var];
, {n, 0, nn}];
Solution in the point t=1/2
Table[N[x[i] /. t -> 1/2, 30], {i, 0, nn}]
{0.5, 0.33921875, 0.2809426617675349, 0.26062635193160333,
0.2536391058021099, 0.25124579177605266, 0.25042664666458403, \ 0.2501461896648886, 0.25005010293913515, 0.25001715807367814,
0.25000585393695235, 0.2500019724479996, 0.25000063876358225, \ 0.2500001802169856, 0.250000022466089, 0.24999996816592682}
Absolute error in the logarithmic scale
LogPlot[Abs[t^2 - x[nn]], {t, 0, 1},
AxesLabel -> {"t", "Absolute error"}]

We also can solve this problem with zero absolute error using the Euler wavelets colocation method described in our paper and on my page as follows
eq = D[x[s], {s, 2}] + x[s]^2 - s^4 - 2 == 0; bc = {x[0] == 0,
x[1] == 1}; xs[t_] := t^2;
UE[m_, t_] := EulerE[m, t]
psi[k_, n_, m_, t_] :=
Piecewise[{{2^(k/2) Sqrt[2/Pi] UE[m, 2^k t - 2 n + 1], (n - 1)/
2^(k - 1) <= t < n/2^(k - 1)}, {0, True}}]
PsiE[k_, M_, t_] :=
Flatten[Table[psi[k, n, m, t], {n, 1, 2^(k - 1)}, {m, 0, M - 1}]]
k0 = 3; M0 = 3; nn =
Total[With[{k = k0, M = M0},
Flatten[Table[1, {n, 1, 2^(k - 1)}, {m, 0, M - 1}]]]]
dx = 1/(nn); xl = Table[ l*dx, {l, 0, nn}]; tcol =
Table[(xl[[l - 1]] + xl[[l]])/2, {l, 2, nn + 1}]; Psijk =
With[{k = k0, M = M0}, PsiE[k, M, t1]]; Int1 =
With[{k = k0, M = M0}, Integrate[PsiE[k, M, t1], t1]];
Int2 = Integrate[Int1, t1]; Psi[y_] := Psijk /. t1 -> y;
int1[y_] := Int1 /. t1 -> y; int2[y_] := Int2 /. t1 -> y;
M = nn; var = Array[v, {M}];
X2[t_] := var . Psi[t]; X1[t_] := var . int1[t] + v1;
X[t_] := var . int2[t] + v1 t + v0;
eqn = Join[
Table[X2[s] + X[s]^2 - s^4 - 2 == 0, {s, tcol}], {X[0] == 0,
X[1] == 1}]; varM = Join[{v0, v1}, var];
sol = FindRoot[eqn, Table[{varM[[i]], 1/10}, {i, Length[varM]}]]
Visualization numerical solution and error
Show[Plot[xs[t], {t, 0, 1}],
ListPlot[Table[{t, X[t] /. sol}, {t, tcol}], PlotStyle -> Red]]
ListPlot[Table[xs[t] - X[t] /. sol, {t, tcol}], PlotStyle -> Red,
Filling -> Axis]

To decries error we use option
sol1 = FindRoot[eqn, Table[{varM[[i]], 1/10}, {i, Length[varM]}],
WorkingPrecision -> 100];
Error of this solution is zero
Table[xs[t] - X[t] /. sol1, {t, tcol}]
Out[]= {0.10^-103, 0.10^-102, 0.10^-102, 0.10^-102, 0.10^-101,
0.10^-101, 0.10^-101, 0.10^-101, 0.10^-101, 0.10^-101,
0.10^-101, 0.10^-101}
x[(n + 1) _]makes no sense, it is not a proper pattern. Asnhas an integer value here, simply usex[n+1] = x[n] + h*Integrate...without using patterns. – Roman Feb 28 '22 at 10:48