This is a double negative, i.e. "not to do" and "no harm". This is not grammatically correct. The grammatically correct version should be "won't do any harm".
Double negatives usually mean a positive and should be avoided to prevent confusion.
In the case of song lyrics and poems, it's often called "poetic license", which means the artist or poet has 'permission' to be grammatically incorrect if it adds a better flow to the music.
Poetic license defined by dictionary.com: "liberty taken by a poet, prose writer, or other artist in deviating from rule, conventional form, logic, or fact, in order to produce a desired effect."
Other examples of the use of poetic license include Pink Floyd's song "Another Brick in the Wall", where the lyrics are "we don't need no education", which is ironic, because due to the double negative, it actually indicates they need an education.