Generation of modulated magnetic structure based on cluster multipole: Application to $\alpha$-Mn and Co$M_3$S$_6$