What Trump said is racist because he assumed they are not Americans because they're not white (have you ever heard him refer to a white person as not American?) therefore they must hate America when they point out it's flaws. There's also the second part that they should shut up about Americas' flaws since their family's countries are so much worse.
America has flaws and 99% of Americans will admit to this. Hell, we love to hang our dirty laundry fir everyone to see and wring our hands over them. Those congresswomen are fully in their rights to say what they dislike/hate about America.