Hi @Hemanth B ,
According to your error message, please just to be sure check again your database server as it might already contain a database with the same name. Or please check if the file location of this database is correct.
In addition, please check if the parameters of your connection string is right. Please check below blog to get more.
An attempt to attach an auto-named database for file ....database1.mdf failed
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".