To long for a comment. $K(z)$ is related to the Binet's Log Gamma Formulas Binet's, where only the factor $2\,i$ is different. The relation of the integral in the Binet' formulas and your's have to be shown.
EDIT:
I tried to show the relation and proof the identity:
$\int_0^{\infty } \frac{e^{-tz} \left(\frac{t}{2} \cot \
\left(\frac{t}{2}\right)-1\right)}{t^2} \, dt=-2 \int_0^{\infty } \
\frac{\tanh ^{-1}\left(\frac{t}{z}\right)}{e^{2
\pi t}-1} \, dt$ for $z=\frac{m^2}{2a}$
Numerical experiment show, that the right hand side is just an approximation of the left hand side for $z>>1$. In other words your solution is only an approximation.
Proof of the identity
The statement above is not correct, I managed to find the proof of the identity.
We start with the identity above:
$$\int_0^{\infty } \frac{e^{-m^2 x} (a x \cot (a x)-1)}{x^2} \, dx=a \
K\left[\frac{i\, m^2}{2 a}\right]$$
with
$$K(z)=2 i \left(\left(z-\frac{1}{2}\right) \log (z)-z-\log (\Gamma \
(z))+\frac{1}{2} \,\log (2\, \pi )\right)$$
- Variable substitution:
Set: $y = 2 \,a\, x$ and $z=\frac{i\,m^2}{2\,a}$
$$\int_0^{\infty } \frac{2\, a \,\left(\frac{y}{2} \,\cot \left(\frac{y}{2}\right)-1\right) e^{i\,z\,y}}{y^2}\, dy=2\,a\, i \left(\left(z-\frac{1}{2}\right) \log (z)-z-\log (\Gamma \
(z))+\frac{1}{2} \,\log (2\, \pi )\right)$$
- Differentiation
Differentiate both sides with respect to z:
$$\int_0^{\infty } \frac{e^{i\, y \,z} \left(\frac{y}{2}\, \cot\left(\frac{y}{2}\right)-1\right)}{y} \, dy=-\frac{1}{2 z}+\log \
(z)-\psi(z)$$
where $\psi(z)$ is the digamma function.
3.) Redefine z
It is easier to go further with $w=\frac{z}{i}$
4.) Integration
We split the indefinite integral in two parts:
$$\int \frac{e^{-w\, y} \left(\frac{y}{2} \cot \left(\frac{y}{2}\right)-1\right)}{y} \, dy=\frac{1}{2} \int e^{-w \,y} \cot \left(\frac{y}{2}\right)\, dy-\int \frac{e^{-w\, y}}{y} \, dy$$
and substitute the integration limits later. The first Integral is just the half of the Laplace-Transform of ${\cot \left(\frac{y}{2}\right)}$. The last integral is the well known ExpIntegraE - Function $\text{Ei}(-w\, y)$.
The first integral can also alternatively done with Mathematica:
$$\frac{1}{2} \int e^{-w\, y} \cot \left(\frac{y}{2}\right) \, \
dy=-\,\frac{1}{2} \left(B_{e^{i\, y}}(1+i\, w,0) + B_{e^{i\, y}}(i\, w,0)\right)$$
where $B_z(a,b)$ is the Euler beta function. One can proof that by differentiation.
5.) Insertion of integration limits
If we insert the integration limits we finally get:
$$\int_0^{\infty } \frac{e^{-w\, y} \left(\frac{y}{2} \cot\left(\frac{y}{2}\right)-1\right)}{y} \, dy= -\, \frac{1}{2} \left(\log\left(-\frac{1}{z}\right)-\log(-z)+\psi(1+i\, z)+\psi(i\, z)-i \,\pi \right)$$
Further simplification and using:
$$\frac{1}{2} \psi(1+i\, z)+\frac{\psi(i \,z)}{2}=\psi(i\, w)-\frac{i}{2\, w}$$
leads to the postulate identity.
\left(\frac{t}{2}\right)-1\right)}{t^2} , dt=-2 \int_0^{\infty }
\frac{\tanh ^{-1}\left(\frac{t}{z}\right)}{e^{2 \pi t}-1} , dt$ for $z=\frac{m^2}{2a}$ should hold for all $z$. But Mathematica for some values does not confirm this statement. – Oct 10 '19 at 18:49