the splines stop it rotating in the hub and the nut stops it popping off.. is it the sam driveshaft you removed or another ??
you will no if its in properly as when the nut done up should be about 5mm thread poking from end of the nut and remember to do nut up to 265nm iirc..