Retirement tax questions

Yes, you can only contribute for the prior year.  Until the due date (April 15) of the return.
If you are over 50 you can contribute more but it’s still only for the current (or prior) year.