Here's a very simple example - note that you should avoid hardcoding values :
Profile prof=[select id from Profile
where name='System Administrator'];
User user = new User(Alias = 'unitTest', Email='testuser@testorg.com',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_GB', ProfileId = prof.Id,
TimeZoneSidKey='Europe/London', UserName='unit.test@unit.test');
insert user;
Line: 9, Column: 1 System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_USERNAME, Duplicate Username.<br>The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address). : [Username]
So the error is pretty clear - there is already a user with that name in Salesforce (not necessarily your Salesforce) and usernames have to be unique. You will therefore have to choose a different username for your new user.
Just change the username value to something other than unit.test@unit.test. If you are struggling with that you might want to go back to basics with Apex via Trailhead:
http://salesforce.stackexchange.com/questions/3967/creating-a-user-with-dml
http://murthyvvr.blogspot.in/2013/11/creating-salesforce-users-from-apex.html
http://codedevstuff.blogspot.in/2014/07/create-salesforce-user-in-apex-with-all.html
Regards
Prad
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_USERNAME, Duplicate Username.<br>The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address). : [Username]
https://developer.salesforce.com/trailhead/module/apex_database
Make sure that every time you create user using the apex, you should give unique name as mentioned by Bob.
Regards
Prad