insert functionality done
without using iterator