Hi :) I'm not a teacher, but I am a native speaker. I hope this helps.
There's something subtly wrong with the words "for the previous company." I'm sorry I can't clearly explain why. It just seems a bit off to me.
The sentence would work perfectly if you named the company: "I gained a lot of practical experience when I worked for Microsoft."
I believe you could also say, "I gained a lot of practical experience in my previous employment"