Ok. It sounds like when you added all those fish 2 weeks ago, your BB from cycling was not strong enough to keep up witgh all the new bio-load, and you are going through a mini cycle.
First and most important, you need to get those ammonia and nitrite numbers down to below .50. I would do a couple back to back 50% water changes asap. What that means is do a 50% water change (use prime, I think its 1ml per 10gal, so use 2ml with EVERY water change, even when you only change 50% of the water, as Prime will help keep the high ammonia levels at a less toxic lever for the fish), and then wait 1-2 hours, and do another 50% water change. Wait the couple hours to give the filter a chance to turn over all the water and mix the old with new water. Test again about an hour after the 2nd water change, and see where your ammonia and nitrite levels are at. They need to stay under .50ppm or they can be toxic to the fish. You will need to test every day for the next little while until those levels decrease, and keep up with daily water changes, sometimes 2, depending on those numbers.
As far as nitrates go..........40ppm is fairly high, especially for tap water, but that is much less of a concern right now than the ammonia and nitrites. WHen you test for nitrates, make sure to follow the directions and shake those bottles and tube well. If your arm doesnt hurt, you probably didnt shake it well enough. If the reading are still that high, you might want to consider cutting the tap water with RO
water, or even distilled. Ideally you want to keep your nitrates around 20ppm or lower, but again, the bigger concern right now is with the ammonia and nitrites.
Check out this link for more details on "fish-in cycling", which is basically what you are going through right now.
I just learned about cycling but I already have fish. What now?! - Aquarium Advice
Best of luck! It might seem stressful right now, but keep up on the water changes, and things will balance out pretty soon and you will be able to relax and enjoy those fish