Yes your method is correct according to the question .
Regarding the second part of your question,
You fetched
$n'\equiv0(mod9)$
$n'\equiv1(mod9)$
$n'\equiv8(mod9)$
$\forall n'\in\mathbb Z $and n' is the sum of 3 cubes
Now you see
The actual definition of congruences is
If $ m\equiv n(mod a)$
$Then ,$
$m=a.q_1+r$
And $b=a.q_2+r$
Where $ a,q_1,q_2,r\in \mathbb Z$
Or in other words two numbers are said to be congruent modulo a iff they leave same remaiders when divided by a
Now you see we say
If $m\equiv n(mod a)$,
Then $m\equiv n\pm k.a(mod a)$
PROOF:
Given:$m\equiv n(mod a)$
To show:$m\equiv n\pm k.a(mod a)$
proof:
If $m\equiv n(mod a)$.
Then m and n leaves same remainder with a.
Now,
$n=a.q_2+r$.
$\Rightarrow n\pm k.a=a.q_2+r\pm k.a$
$\Rightarrow n\pm k.a=a(q_2\pm k.a)+r$ where $k\in \mathbb Z$
Now ,
Since $q_2,k\in \mathbb Z$
And $q_2 \pm k.a\in \mathbb Z$
So we see now $n \pm a $ leaves same remainder as m and n
So we can say,
$m\equiv n\pm k.a (mod a)$
-×-×-×-×-×-×-×-×-×-×-
Using this theorem as we prove what you have asked
You found
$n'\equiv 8(mod9)$
Therefore $n'\equiv 8-9(mod 9)$
So we get $n'\equiv -1(mod 9)$
So writing 8(mod 9) and -1(mod 9) is all the same.
So you are done!!
Rabin has given a randomized algorithm for expressing prime $p = 4k+1$ as a sum of two squares in expected time $O(\log p)$. This previously published method is described in the first section of Rabin and Shallit's 1986 paper, "Randomized Algorithms in Number Theory" (Comm. in Pure and Applied Math v.39(supplement):S239-S256). See also the previous Question Efficiently finding two squares which sum to a prime.
For a general non-prime $n$ which you "know beforehand ... is representable as a sum of two squares", I'm not aware of an equally fast method. Perhaps this knowledge comes with some sort of "certificate" that would be useful in finding the decomposition. A somewhat naive approach would be perform a saddleback search for $a \ge b \ge 0$ such that $a^2 + b^2 = n$ starting at a guess $a = \lfloor \sqrt n \rfloor$.
The well-known identity:
$$ (a^2+b^2)(c^2+d^2)=(ac+bd)^2+(ad-bc)^2 $$
allows us (among other things) to focus on the case $n$ odd by eliminating factors of $2=1^2 + 1^2$.
Best Answer
$$x^2 \equiv 0, 1, 4, 7 \pmod 9$$
Thus, sum of two squares can only be $0, 1, 2, 4, 5, 7, 8 \pmod 9$.
Hence, numbers $\equiv 3, 6 \pmod 9$ are not expressible as the sum of 2 squares.