You can write your novel in any order you wish as long as it works for you. I know many authors who plot out their story then, when they sit down at the computer, decide which scene they wish to write that day. It works for them.
Not for me. I plow ahead one scene at a time and all in order. But that’s me.
You figure out for yourself how you wish to write your novel. If you’re thinking of writing the ending first, that’s an indication that’s the way that works for you.
Any number of writers like to write the ending long, long before getting there because then they know precisely where their story should be heading. Knowing that keeps them on track and prevents side-stories that mess up the whole novel.