If he kicks the ball in the end zone, the penalty is what results in the safety. However, if he kicks the ball before it crosses the goal line, I'm pretty sure the penalty is assessed from the spot of the illegal kick, so the opposing team would get the ball 10 yards/half the distance from the spot of the illegal kick (this is 12-4-2 in the NFL rulebook).