We construct a homomorphism from the affine Yangian \(Y_{\hbar ,\varepsilon +\hbar }(\widehat{\mathfrak {sl}}(n))\) to the affine Yangian \(Y_{\hbar ,\varepsilon }(\widehat{\mathfrak {sl}}(n+1))\) which is different from the one in Ueda (A homomorphism from the affine Yangian \(Y_{\hbar ,\varepsilon }(\widehat{\mathfrak {sl}}(n))\) to the affine Yangian \(Y_{\hbar ,\varepsilon }(\widehat{\mathfrak {sl}}(n+1))\) , 2023. arXiv:2312.09933). By using this homomorphism, we give a homomorphism from \(Y_{\hbar ,\varepsilon }(\widehat{\mathfrak {sl}}(n))\otimes Y_{\hbar ,\varepsilon +n\hbar }(\widehat{\mathfrak {sl}}(m))\) to \(Y_{\hbar ,\varepsilon }(\widehat{\mathfrak {sl}}(m+n))\) . As an application, we construct a homomorphism from the affine Yangian \(Y_{\hbar ,\varepsilon +n\hbar }(\widehat{\mathfrak {sl}}(m))\) to the centralizer algebra of the pair of affine Lie algebras \((\widehat{\mathfrak {gl}}(m+n),\widehat{\mathfrak {sl}}(n))\) and the coset vertex algebra of the pair of rectangular W-algebras \(\mathcal {W}^k(\mathfrak {gl}(2m+2n),(2^{m+n}))\) and \(\mathcal {W}^{k+m}(\mathfrak {sl}(2n),(2^{n}))\) .