X-shooter spectroscopy of young stellar objects. IV. Accretion in low-mass stars and substellar objects in Lupus