Section 27. A city or town clerk or registrar refusing or neglecting to perform any duty required of him under this chapter shall be punished by a fine of not less than twenty nor more than one hundred dollars. Fines recovered for violation of section eighteen shall be to the use of the commonwealth.