Hi hiteksha,
If you're using Dynamics CRM 2011, I suggest using the duplicate detection rule for this. You wouldn't need to code. However, if you're using CRM 2013, then only a Plugin can meet your requirement. Just to give you a outline of what you need to code inside
the plugin:
1. You need to register the plugin in the Create event in the Pre Stage of Account entity.
2. Inside the Plugin code, retrieve the first and last name of the record (account). You will get this from the context itself.
3. Make a RetrieveMultiple query by providing filter criteria with first and last name of the account (you got from context) and see if you have any records.
4. If you have any records, throw an uncaught exception with a message like "Unable to create Account. An Account with the same name already exists". If you don't have any records from the result, no need to do anything and the Account record will be created.
Admin QuikView Solution for CRM 2013