This paper considers two-way relaying systems with a multiple-input multiple-output (MIMO) relay between two MIMO terminal nodes. The two-way relaying protocol can enhance the spectral efficiency compared with the one-way protocol by compensating the loss from half-duplex signaling. In this paper, we propose an iterative scheme to find a relay weighting matrix maximizing the sum-rate for two-way relay channels. Due to the non-convexity of the given problem, the proposed scheme iteratively identifies a local optimal solution by deriving the gradient of the sum-rate and applying the gradient descent algorithm. Simulation results show that the proposed iterative scheme with provable convergence achieves a near-optimal sum-rate for the two-way MIMO relay channels. Also, we show that the proposed scheme with a few iterations still outperforms the conventional schemes.