Effect of plasma density gradients on generation of terahertz radiation in magnetized plasma column during relaxation of kiloampere REB inside it