Replacing duplicate line on the specified string