You should always write a resignation letter because it’s a:
polite custom (employers expect you to give them a resignation letter as a matter of courtesy)
record of your exit date
formal expression of gratitude for the opportunity to work for your employer
good way to establish a positive relationship going forward, which can help you get positive reviews from your managers if you need them