Edit: The description above of the cofree coalgebra is incorrect. I learned the correct version from Alex Chirvasitu. The description is as follows. Let $V$ be a vector space, and write $\mathcal T(V)$ for the tensor algebra of $V$, i.e. for the free associative algebra generated by $V$. Then the cofree coassociative algebra cogenerated by $V$ is constructed as follows. First, construct $\mathcal T(V^\ast)$, and second construct its finite dual $\mathcal T(V^\ast)^\circ$, which is the direct limit of duals to finite-dimensional quotients of $\mathcal T(V^\ast)$. There is a natural inclusion $\mathcal T(V^\ast)^\circ \hookrightarrow \mathcal T(V^\ast)^\ast$, and a natural map $\mathcal T(V^\ast)^\ast \to V^{\ast\ast}$ dual to the inclusion $V^\ast \to \mathcal T(V^\ast)$. Finally, construct $\operatorname{Cofree}(V) = V \times_{V^{\ast\ast}} \mathcal T(V^\ast)^\circ$.$\operatorname{Cofree}(V)$ as the union of all subcoalgebras of $\mathcal T(V^\ast)^\circ$ that map to $V \subseteq V^{\ast\ast}$ under the map $\mathcal T(V^\ast)^\circ \hookrightarrow \mathcal T(V^\ast)^\ast \to V^{\ast\ast}$. Details are in section 6.4 (and specifically 6.4.2) of the book Hopf Algebras by Moss E. Sweedler.