the butter and the fat in the eggs help make your donut soft and rich. the sugar sweetens the dough and helps it brown during frying (thanks to the mailard reaction).