Correlation between compositional fluctuation and magnetic properties of Tm-doped AlGaN alloys