You need to be sure the SDE connection file you want to use is accessible by the user running the script, on the machine running the script.
"Database Connections" is a shortcut to a folder under the current user profile, e.g.: %APPDATA%\ESRI\Desktop10.1\ArcCatalog
. You do NOT have to use this shortcut! You can just as easily specify the full path to the file. You can put the file anywhere, but I would recommend a secure network location that only the appropriate users can access.
If you want to create the SDE connection file programmatically you can use the Create Database Connection or Create ArcSDE Connection tools.
The main difference between these two tools is that the former is intended for direct (2-tier) connections to the database, while the latter is intended for application server (3-tier) connections through an ArcSDE service, although in practice you can use the latter for direct connections as well.