The difference is @arnelgp code is using set-based update, your method is sometimes called RBAR .
You should where possible always try and use a set-based update or insert in your processes.
We are all in the "process of becoming" ... and get there through trying. Keep up the good work in taking suggestions and you will become more proficient every day!