Better way to write?

Its not that I am ashamed of how I wrote my code I just think their is a better way to right to script below.(Not sure how) In order for me to use some commands I have to login to use sudo, I usually do this by launching terminal then sudo whatever and logging in then running the applescript. Any thoughts?

set thisDialog to display dialog "What Is The Url Of The Download Source?" default answer "http://superb-west.dl.sourceforge.net/sourceforge/clamav/clamav-0.90.2.tar.gz"
set textReturned to text returned of thisDialog
set targetSave to (POSIX path of (path to desktop))
do shell script "cd " & targetSave & ";/usr/bin/curl --silent --remote-name " & quoted form of textReturned
set AppleScript's text item delimiters to {"/"}
set fileName to last text item of textReturned as string
set AppleScript's text item delimiters to {""}
set AppleScript's text item delimiters to {"."}
set clamtext1 to first text item of fileName as string
set clamtext2 to second text item of fileName as string
set clamtext3 to third text item of fileName as string
set clamtext4 to fourth text item of fileName as string
set p to "." as string
set AppleScript's text item delimiters to {""}
set ClamAvTarGzArchive to ((path to desktop) & fileName) as string
set ClamAvTarArchive to ((path to desktop) & clamtext1 & p & clamtext2 & p & clamtext3 & p & clamtext4) as string
tell application "StuffIt Expander" to expand ClamAvTarGzArchive
tell application "StuffIt Expander" to expand ClamAvTarArchive
tell application "Finder" to move file ClamAvTarGzArchive to trash
tell application "Finder" to move file ClamAvTarArchive to trash
set targetClamavFolder to ((path to desktop) & clamtext1 & p & clamtext2 & p & clamtext3) as string
set freshclamLocation to targetClamavFolder & ":etc:freshclam.conf" as string
tell application "Finder" to move file freshclamLocation to trash
try
	set freshClamContent to "DNSDatabaseInfo current.cvd.clamav.net
DatabaseMirror database.clamav.net
MaxAttempts 3
Checks 12
ScriptedUpdates yes"
	set freshclamFilePath to freshclamLocation
	set fileRef to open for access freshclamFilePath with write permission
	set eof fileRef to 0
	write freshClamContent to fileRef
	close access fileRef
on error
	try
		close access fileRef
		display dialog "Something Went Wrong With Opening/Writing: freshclam.conf"
	end try
end try
try
	do shell script "cd " & POSIX path of file targetClamavFolder & ";./configure --prefix=/usr/local/clamXav"
	do shell script "cd " & POSIX path of file targetClamavFolder & ";make"
	do shell script "cd " & POSIX path of file targetClamavFolder & ";sudo make install"
on error
	display dialog "Something Went Wrong In The Build Process"
end try
try
	do shell script "sudo chown -R root:admin /usr/local/clamXav/etc"
	do shell script "sudo chmod 0775 /usr/local/clamXav/etc"
	do shell script "sudo chmod 0664 /usr/local/clamXav/etc/*"
	do shell script "sudo chown -R root:admin /usr/local/clamXav/bin"
	do shell script "sudo chmod 0755 /usr/local/clamXav/bin"
	do shell script "sudo chmod 0755 /usr/local/clamXav/bin/*"
	do shell script "sudo chown clamav /usr/local/clamXav/bin/freshclam"
	do shell script "sudo chmod u+s /usr/local/clamXav/bin/freshclam"
	do shell script "sudo chown -R clamav:clamav /usr/local/clamXav/share/clamav"
	do shell script "sudo chmod 0755 /usr/local/clamXav/share/clamav"
	do shell script "sudo chmod 0644 /usr/local/clamXav/share/clamav/*"
	do shell script "sudo touch /usr/local/clamXav/share/clamav/freshclam.log"
	do shell script "sudo chmod a+rw /usr/local/clamXav/share/clamav/freshclam.log"
on error
	display dialog "Something Went Wrong When I Tried To Set Permissions On Files!"
end try

What would be cool is if when I put this script into an automator action and save it as .app It could ask for name and pass in a dialog like software update does when it needs to install updates.

Some inital comments. Try to avoid repeated tells and do shell scripts where possible. So for example

tell application "StuffIt Expander" to expand ClamAvTarGzArchive
tell application "StuffIt Expander" to expand ClamAvTarArchive

becomes

tell application "StuffIt Expander"
	expand ClamAvTarGzArchive
	expand ClamAvTarArchive
end tell

sure its more code, but it will help with performance. On your do shell scripts feed them all into one line like you did in a few places. Again limiting the number of do shell scripts will help with performance.

Instead of sudo you could do this…

do shell script "chown -R root:admin /usr/local/clamXav/etc;" & ¬
		"chmod 0775 /usr/local/clamXav/etc;" & ¬
		"chmod 0664 /usr/local/clamXav/etc/*;" & ¬
		"chown -R root:admin /usr/local/clamXav/bin;" & ¬
		"chmod 0755 /usr/local/clamXav/bin;" & ¬
		"chmod 0755 /usr/local/clamXav/bin/*;" & ¬
		"chown clamav /usr/local/clamXav/bin/freshclam;" & ¬
		"chmod u+s /usr/local/clamXav/bin/freshclam;" & ¬
		"chown -R clamav:clamav /usr/local/clamXav/share/clamav;" & ¬
		"chmod 0755 /usr/local/clamXav/share/clamav;" & ¬
		"chmod 0644 /usr/local/clamXav/share/clamav/*;" & ¬
		"touch /usr/local/clamXav/share/clamav/freshclam.log;" & ¬
		"chmod a+rw /usr/local/clamXav/share/clamav/freshclam.log" with administrator privileges

Doing this will bring up an standard authentication dialog. If your users succesfully authenticate the command will run. Cancelling or 3 incorrecte user:pass attempts will trigger a on error block if you place it in one.