Effect of doping with magnetic cations on the hybrid improper ferroelectricity in Sr3Sn2O7