Long story short: indefinite integrals should be thought of as a family of functions, and the addition of such sets is indeed well defined; you just define the addition as you have done it.
First we fix some notation:
- Let $U\subset \Bbb{R}$ be a non-empty open set (think of an open interval if you wish).
- Let $D_{U,\Bbb{R}}$ be the set of all differentiable functions $F:U \to \Bbb{R}$.
- Let $E_{U,\Bbb{R}}$ be the set of all "exact functions"; i.e the set of $f:U \to \Bbb{R}$, such that there exists $F\in D_{U,\Bbb{R}}$ such that $F' = f$ (said differently, $E_{U,\Bbb{R}}$ is the image of $D_{U,\Bbb{R}}$ under the derivative mapping $F\mapsto F'$).
- Finally, let $Z_{U,\Bbb{R}}$ (Z for zero lol) be the set of all $F\in D_{U,\Bbb{R}}$ such that $F'=0$ (i.e for every $x\in U$, $F'(x)=0$).
For the sake of simplicity, since I'm going to keep the open set $U$ fixed for most of this discussion, I'll just write $D,E,Z$ instead of $D_{U,\Bbb{R}},E_{U,\Bbb{R}},Z_{U,\Bbb{R}}$. Now, notice that $D,E,Z$ are all real vector spaces, and that $Z$ is a vector-subspace of $D$. So, we can consider the quotient vector space $D/Z$.
With this in mind, formally, indefinite integration/anti-differentiation is a map $E \to D/Z$. So, given a function $f\in E$, when we write $\int f(x)\, dx$, what we mean is that
\begin{align}
\int f(x)\, dx &:= \{G \in D| \, \, G' = f\}
\end{align}
(of course the letter $x$ appearing is a "dummy variable", it has no real significance). And suppose we know that $F\in D$ is a particular function such that $F' = f$. Then,
\begin{align}
\int f(x)\, dx &= \{G \in D| \, \, G' = f\} = \{F + g | \, \, g \in Z\}
\end{align}
For example, take $U = \Bbb{R}$, and let $f(x) = x^2$. So, when we write $\int x^2 \, dx$, what we mean is the family of functions $\{F| \, \text{for all $x\in \Bbb{R}$, $F'(x) = x^2$}\} = \{x \mapsto \frac{x^3}{3} + C | \, \, C \in \Bbb{R}\}$.
Next, if we have $f(x) = 2x + \cos x$, and $U = \Bbb{R}$ again, then we have (after proving linearity)
\begin{align}
\int 2x + \cos x \, dx&= \int 2x\, dx + \int \cos x \, dx \\
&= \{x \mapsto x^2 + C | \, \, C \in \Bbb{R}\} + \{x \mapsto \sin x + C| \, \, C\in \Bbb{R}\} \\
&:= \{x \mapsto x^2 + \sin x + C |\, \, C \in \Bbb{R}\}
\end{align}
The last equal sign is by definition of how addition is defined in the quotient space $D/Z$. We can rewrite this chain of equalities using the $[\cdot]$ notation for equivalence classes as follows:
\begin{align}
\int 2x + \cos x \, dx &= \int 2x \, dx + \int \cos x \, dx \\
&= [x\mapsto x^2] + [x \mapsto \sin x] \\
&=[x \mapsto x^2 + \sin x]
\end{align}
So, really, any indefinite integral calculation you have to do, if you want to be super precise, just put $[]$ around everything, to indicate that you're considering equivalence classes of functions; with this all the equal signs appearing above are actual equalities of elements in the quotient space $D/Z$.
Just in case you're not comfortable with quotient spaces, here's a brief review: we can define a relation (which you can easily verify is an equivalence relation) $\sim_Z$ on $D$ by saying $F_1 \sim_Z F_2$ if and only if $F_1 - F_2 \in Z$ (in words, two functions are related if and only if the difference of their derivatives is $0$, or equivalently, $F_1\sim_ZF_2$ if and only if they have the same derivatives $F_1' = F_2'$). Then, we define $D/Z$ to be the set of all equivalence classes.
This means an element of $D/Z$ looks like $\{F + f| \, \, f \in Z\}$, where $F\in D$. Typically, we use the notation $[F]_Z$ or simply $[F]$ to denote the equivalence class containing $F$; i.e $[F]= \{F + f| \, \, f \in Z\}$. Now, it is a standard linear algebra construction to see that the quotient of vector spaces can naturally also be given a vector space structure, where we define addition and scalar multiplication by: for all $c\in \Bbb{R}$, all $[F],[G] \in D/Z$,
\begin{align}
c\cdot[F] +[G] := [c\cdot F + G]
\end{align}
This is a well-defined operation. So, this is a way to define the addition of two sets, and multiply a set by a scalar multiple, all in the context of quotient vector spaces.
Finally, I'm not sure how comfortable with linear algebra you are, but let me just add this in, and maybe you'll find it helpful in the future. Here's a very general construction and theorem:
Let $V,W$ be vector spaces over a field $\Bbb{F}$, let $T:V \to W$ be a linear map. Then, this induces a well-defined map on the quotient space $\overline{T}: V/\ker(T) \to W$ by
\begin{align}
\overline{T}([v]) := T(v)
\end{align}
The first isomorphism theorem of linear algebra states that $V/\ker(T)$ is isomorphic to $\text{image}(T)$, and that $\overline{T}: V/\ker(T) \to \text{image}(T)$ is an isomorphism (i.e linear with linear inverse and also bijective).
The reason I bring this up is because it relates very much to indefinite integration. For example, take $V = D_{U,\Bbb{R}}$ to be the space of all differentiable functions, and $W = E_{U,\Bbb{R}}$, and consider the derivative mapping $T =\frac{d}{dx}$ going from $V \to W$. Now, the image of the differentiation map $\frac{d}{dx}$ is $W = E_{U,\Bbb{R}}$ by construction, and the kernel of this map is exactly $Z_{U,\Bbb{R}}$ (the set of functions whose derivative is $0$). So, by the general considerations above, this induces an isomorphism $\overline{T}:V/\ker(T) \to W$ (i.e by plugging everything in, we have an isomorphism $\overline{\frac{d}{dx}}: D_{U,\Bbb{R}}/Z_{U,\Bbb{R}} \to E_{U,\Bbb{R}}$), and indefinite integration is defined as the inverse of this map:
\begin{align}
\int := \left(\overline{\frac{d}{dx}}\right)^{-1}: E_{U,\Bbb{R}} \to D_{U,\Bbb{R}}/Z_{U,\Bbb{R}}
\end{align}