The immediate error is simple. You copied age to age_cat so age_cat is evidently a numeric variable, just like age. You then tried to replace it with string values. That's a type mismatch and Stata bailed out.
Alternatively, if age is really a string variable, then comparing it with numeric values such as 18 is also a type mismatch.
The rest of your syntax would have failed any way. The logical operator | (or) can be used to separate input conditions. It can never be used to separate different results.
Here is a slow way to do what you want, assuming age is numeric:
gen age_cat = "Adult" if inrange(age, 19, .)
replace age_cat = "12-18 years" if inrange(age, 12, 18)
replace age_cat = "6-11 years" if inrange(age, 6, 11)
replace age_cat = "0-5 years" if inrange(age, 0, 5)
I've added code such that missing ages, which count as more than 18, will not get classified as Adult.
Here's another way to do it:
gen age_cat = cond(age > 18, "Adult", cond(age >= 12, "12-18 years", cond(age >= 6, "6-11 years", "0-5 years))) if age < .
where I have made a trap for missing values explicit. cond() is the equivalent of ifelse() in various languages. See also this tutorial if you want more detail.
There is also recode, which appeals to many people.
encodeis not for string to numeric replace; it is for generating new variables. It's sometimes but not always the right thing to do if you have a string variable and want a numeric.