If you are living outside of the US when your diversity visa is issued to you, the visa is usually valid for six months and you must travel to the United States before it expires.
For example, if you participated in the DV Lottery program for calendar year 2020, the latest date on which a diversity visa can be issued to you is on September 30, 2021. So the hypothetical last date on which you would be allowed to travel to the United States is on March 30, 2022. Remember, however, that the dates are dependent on the date your diversity visa is issued.
You must travel to the U.S. before your permanent resident card (green card) is sent to you.