Is a function of $\mathbb N$ known producing only prime numbers?

The answer to your question is no. For any $a>1,b\geq 1$ there will always exists $n$ such that $a^n+b$ is composite.

Suppose that $a+b$ is prime, (otherwise we are finished) and consider $n=a+b$ and look at $a^{a+b}+b$ modulo $a+b$. Then by Fermat's little theorem, which states that $$a^p\equiv a\pmod{p}$$ for any prime $p$, it follows that $$a^{a+b}+b\equiv a+b\equiv 0\pmod{a+b},$$ and so $a^{a+b}+b$ is divisible by $a+b$ and hence it is composite.


If there were such a function, then we wouldn't be talking about "largest prime yet discovered". We'd have an infinite number of them at our disposal. So no... we have no such closed form function.