Who the heck are you? Definitely a troll. Are you 12? Does your knowledge of firearms exist entirely from Call of Duty?
A). OP said he couldn't afford an AR right now. A Benelli M1014 (the military designation for the M4) is expensive. Really expensive. An M4 is somewhere between $1400 and $1800 normally. A M1014 is even more so, because they're fairly rare to find one marked as such.
B). I would take a Remington 870 over a Benelli M4 any day. And I own both. Both are outstanding weapon systems, but when **** hits the fan, the 870 will cycle ANYTHING. They are bulletproof. A Glock, an 870, and an AK would be a person's dream when facing any and all elements; they're ultra reliable.
OP: Do a search and read around at some of the other similar topics that have been posted in this sub forum before. Take advice with a grain of salt. The people who you should rely on are a short list: Reedo302, GlockMan, JonJon, Serbonze, Adam@Euro-Spec, Tailo, and maybe myself. There are a few others who know their stuff as well, but there are also trolls like this fool who I quoted who are grossly misinformed and really will hand you poor advice.
The search will open your eyes a bit, but I will make a few points.
1). Do not buy a shotgun. For one, it has a questionable reputation as the gun of choice for home defense. The reality is that it over-penetrates, has limited capacity, and is the most complex weapons system. Another thing is that if you want to learn to shoot, this is not the gun for you. I think you'll find it difficult to find a range that will let you shoot the thing consistently (other than a skeet/trap range) and it's not going to help much with basic marksmanship.
2) That leaves a handgun, an AR, or some other long gun/rifle. Now, you said that the AR is cost prohibitive at the moment. I get that, but you can start off cheap. There are quality AR platforms available for less than $700 (S&W M&P 15 Sport). And you might be surprised to know that many consider the AR platform to be ideal for home defense, as it doesnt really over-penetrate and its a simpler system to learn and implement.
Handguns are great; they're the standard for personal defense. However, there are many pitfalls, including buying a cheap weapon or buying the wrong weapon for you based off some preconceived notion of what is good or cool. A quality weapon will cost you anywhere for $400-$1000 and up. Depending on where you fit on that scale, you may find that an AR is not out of reach.
Lastly, you could go with a simple long gun to start. It would most likely be chambered in .22LR. The ammo is super cheap and recoil is almost non-existent. A rifle like this would really hone your marksmanship skills and give you a solid foundation from which to grow. The other great thing is that this is the cheapest option. You could pick up a solid bolt action for between $75 and $150 and a semi-auto like a Ruger 10-22 or a M&P 15-22 for between $250 and $400. You could shoot it ALOT; 500 rounds of .22 is something like $20.
3). Go to the range and take a basic safety class to start, maybe something one-on-one with an instructor for an hour. Some might not agree with me on this, but based on what I've read it seems appropriate. You seem uncertain on how firearms function, bordering on nervousness to use one. Your time witn a rifle will benefit you, but there are many different weapon systems and a handgun is more complex than a traditiknal hunting rifle. I think an hour or so with an instructor would really benefit you. He could explain exactly how a handgun or a rifle operates, what all the controls do, and give you a rundown on some basic shooting techniques. You'd have fun and you'd feel much more confident.
4). After taking the course, find a place that rents firearms and have a blast. Try as many as you can or at least the ones that look appealing. Try one in each of the 3 big calibers (9mm, .40 S&W, .45 ACP) to get a feel for what you like and what you don't. when you select a firearm to rent, ask the clerk to go over it's controls with you and ask if there's anything unique or unusual about it; they'll be happy to help. You want to make sure that you know what everything does and feel confident about your ability to handle it when you enter the range.
5). Once you've done that, come back to us here. Make yourself a list of what firearms you like and maybe some you didn't like. Post that list here and we'll be happy to go over it with you and help you make a choice. Combined, the 7 of us I listed earlier have well over 100 years of practical firearms experience with varying backgrounds from Law Enforement to everyday carrying citizens. Get crackin' on reading some more stuff on the board and get to the range to take that 1 hour instruction and rent some guns.