Correct cost function of multi classification problem using neural network?
The loss function you have shown is not correct.  The correct one is

$$\begin{gather*} J(\Theta) = - \frac{1}{m} \sum_{i=1}^m \sum_{k=1}^K y^{(i)}_k \log ((h_\Theta (x^{(i)}))_k)  \end{gather*}$$

The loss function has a summation over $K$ because we must take into account all possible classes.  The neural network outputs $K$ values, $h_{\Theta}(x^{(i)})$, and the loss function should depend on all $K$ of those.  There is a single loss function because we are training a single neural network, and we need exactly one loss function per neural network; if you wanted to train $K$ neural networks, then you would use $K$ loss functions.

Define $z^{(i)}$ to be the class of $x^{(i)}$ according to the training set, i.e., we take $z^{(i)}$ to be the value of $k$ such that $y^{(i)}_k=1$.  Then 
the loss function above is equivalent to

$$\begin{gather*} J(\Theta) = - \frac{1}{m} \sum_{i=1}^m \log ((h_\Theta (x^{(i)}))_{z^{(i)}})  \end{gather*}$$

which does not have a summation over $K$.

I suggest reading more about the cross-entropy loss.  See, e.g., https://rdipietro.github.io/friendly-intro-to-cross-entropy-loss/

There are some errors in your notation.  The training set has points $(x^{(i)},y^{(i)})$, not $x_i,y_i$.  Here $y^{(i)}_k$ means that $y^{(i)}=k$, not that $y^{(i)}_k=k$ (the latter would be circular, defining $y^{(i)}_k$ in terms of itself).