Image from Purves et al. Excretory system of an earthworm. Image from Purves et al. Body fluids are drawn into the Malphigian tubules by osmosis due to large concentrations of potassium inside the tubule. Body fluids pass back into the body, nitrogenous wastes empty into the insect's gut.
Water is reabsorbed and waste is expelled from the insect.
Excretory system of an ant. Images from Purves et al. ALL vertebrates have paired kidneys. Excretion is not the primary function of kidneys. Kidneys regulate body fluid levels as a primary duty, and remove wastes as a secondary one.