I really want to make a Sorcerer that uses a sword, but I don't know how that could be accomplished in D&D when creating a lvl 1 character. How would I go about accomplishing this?
Step 1: make a sorceror.
Okay, now you've got a sorceror. One-half of the build is complete.
Step 2: use a sword.
Anyone can use any weapon. Sorcerors aren't proficient with swords, but that just means that you don't add your proficiency bonus to attacks made with swords. You can still attack with them, they still do the same damage when they hit. You're at a -2 to hit compared to your proficient allies, but maybe that doesn't worry you.
(optional) Step 2a: gain proficiency with a sword, so you can keep up with all the other sword-swingers...
Races. Be an elf: that gets you proficiency with shortswords (all elves) and with longswords (high and wood elves). Or be a variant human, taking Weapon Master as your starting feat. (You can gain proficiency with four of shortswords, longswords, greatswords, rapiers, and scimitars!) Or be a hobgoblin, gaining proficiency in two martial weapons and light armor. Probably there are other ways, too--there're a lot of races out there!
Multiclassing. Take a level in barbarian, fighter, monk, paladin, ranger, or warlock. Given that you're a sorcerer (CHA-based caster) who wants to use a sword (depending on sword, you'll want STR or DEX pretty high), paladin might be the best fit? Though warlock's always worth looking at closely, since Pact Magic behaves uniquely.
... but only for a while.
This way you can make your one sword attack as well as a "true" martial character. For a few levels. But everyone else using a sword is going to start getting extra attacks, or add sneak attack dice, or smite, or horde-break, or rage, or something. All while you're picking up spell slots and sorcerous abilities.
You're a sorceror, Harry. Taking the Attack action is going to be an increasingly-poor choice relative to your other options as you progress magically.
That being said, there are a couple cantrips that provide some scaling to sword-wielding sorcerers (albeit not to the same degree as most martial classes). With DM approval, Sword Coast Adventurer's Guide offers wizards, sorcerers, and warlocks a couple new spells including green-flame blade and booming blade which let a sorcerer make a weapon attack and then deal some additional damage in certain situations (fire and thunder respectively). [With thanks to @DavidCoffron for the reminder of these cantrips.]
This can be especially useful if coupled with a Sorcerous Origin such as Draconic Bloodline which, starting at level 6, lets you add your Charisma modifier to one damage roll of a spell that deals damage of the type associated with your draconic ancestry.
Step one: Create a Sorcerer
Create either a Draconic Bloodline sorcerer or (if you have access to Xanathar's Guide to Everything) a Shadow Magic sorcerer.
- Draconic Bloodline sorcerers gain extra HP per level and have a base AC of 13 + Dex mod, making you a little tankier.
- Shadow Magic sorcerer has Strength of the Grave, allowing you once a day to return to 1 HP instead of falling unconscious if you pass a Charisma saving throw. It will later will give you a Hound of Ill Omen that you can use as a distraction, or to help you flank (if your DM uses that optional rule).
You will want Dexterity to be your highest or second-highest stat for either build so that you can use a finesse-based blade such as a shortsword or rapier.
Step two (Spell Selection)
As David Coffron suggested in the comments of nitsua60's answer, the booming blade or green-flame blade cantrips will allow you to scale your melee damage somewhat in the early stages. Supplement this with level 1 spells that will help you survive such as shield, mage armor (if you did not go with Draconic Bloodline sorcerer, since different AC calculations don't stack), or expeditious retreat so you can get out of danger.
Upon reaching level 3 and gaining access to 2nd-level spells, take the shadow blade spell (Xanathar's Guide to Everything, page 164), which will allow you to summon a finesse sword that deals 2d8 psychic damage per strike and has advantage on attacks in dim light or darkness.
It is worth noting that this blade only lasts for a minute, so at early levels, this sword should be your trump card, rather than your main weapon and is also a concentration spell, making it vulnerable to being lost, so the War Caster feat is a must.
It may also be worth getting the Dual Wielder feat and wielding two swords for the bonus AC, but in doing so you would likely output more damage using one attack with your booming blade or green-flame blade cantrips than using your bonus-action attack with your second weapon.
Step four (optional; Multiclass)
Multiclass into a Hexblade warlock, which is able to use its Charisma modifier on melee weapon attacks with its pact weapon. Alternatively, this class may suit your needs better overall and is worth looking at if you aren't 100% committed to playing a sorcerer.
As other answers have noted, this build will not scale as well in damage as a sorcerer could otherwise, due to the lack of multiattack for the class.