write packet gen template