help with adding people to database

Well so far this is what i have

set a to text returned of (display dialog "Would you like to add a new user 1 or continue to search database 2?" default answer "1 or 2" buttons {"Search"} default button 1)

if a is equal to "1" then
	set b to text returned of (display dialog "Please enter a random code, perferably short, to set the user as." default answer "code please." buttons {"set"} default button 1)
	set c to text returned of (display dialog "Now please enter the name of the user of which you wish to add followed by the information you wish to store." default answer "name" buttons {"set"} default button 1)
	set b to c
end if
set d to text returned of (display dialog "Would you like to add a new user 1 or continue to search database 2?" default answer "1 or 2" buttons {"Search"} default button 1)
set e to text returned of (display dialog "Please enter the name of the person you wish to search for." default answer "name" buttons {"search"} default button 1)
if e is equal to c then
	set f to button returned of (display dialog c buttons {"exit script", "go back to main menu"} default button 2)
end if

my question is how do i make it so that when people add the users that it actually saves the users for further use, and also if there is a away where i can split the name part away from the info part because when i tried it was in three parts (code) (name) (info) and i didnt know how to make all three of them happen. Thanks in advance and sorry for the dumb questions, im new =]

tom:

Welcome to MacScripter. Saving data is fairly easy, but it really comes down to how you want the data saved. Are you using a database back end like SQLite or MySQL? Do you want to save data in a text file? Perhaps you would like to save things as records or lists?

You will get better assistance by providing more information about what you are trying to do.

ok, sorry i was wanting to save it to a text file

Great! You will find everything you need to know about reading and writing to text files in this article.

Good luck, post back when you have further questions.