JS to add and remove line dynamically