You can either use the standard Moodle form collapsible headings by putting:
$mform->addElement('header', 'name_for_your_header', get_string('headername', 'myplugin'));before each part.
Or, if you really need a custom div, use HTML elements:
$mform->addElement('html', '<div class="some-css-class">'); $mform->addElement('text', 'name', get_string('name')); $mform->setType('name', PARAM_NOTAGS); $mform->setDefault('name', 'Please enter name'); // Make sure you fix this to use a language string, not hard-coded text. $mform->addElement('html', '</div>');