You're not retrieving any rows from the Data Extension you've initialized, so there's nothing to loop around. See the top of the SSJS Core code below for an example of getting "data" from your Data Extension that you could iterate through.
If this is part of something you're doing regularly, although you can do this with WSProxy, I'd recommend using Core SSJS functions to do this. Although Salesforce doesn't monitor API usage actively, there's no reason to assume that they won't see this as an area that could be monetized in the future.
To do what you're attempting to do with WSProxy using standard Core functions, you could do something similar to this:
<script runat="server">
Platform.Load("core","1");
var de = DataExtension.Init("publist");
var data = de.Rows.Retrieve();
if(data){
for (var i = 0; i < data.length; i++){
var sub = {
"EmailAddress": data[i]["EmailAddress"],
"SubscriberKey": data[i]["SubscriberKey"],
"Lists": [{
"Status": "Active",
"ID": 2146,
"Action": "Upsert"
}]
};
var subObj = Subscriber.Init(sub.SubscriberKey);
var status = subObj.Upsert(sub);
} //data.length
} //if(data)
</script>
If you're dealing with a very large number of records (more than a few), SSJS just isn't the way to do this at all. It won't scale to any reasonable volume, even with WSProxy's ability to page through batches of 2.5K records (not implemented in your example). The way to go is SQL and Automation Studio:
Create a new scheduled Automation
Create a Data Extension to hold the results of the query below
Create a Query Activity with similar code to get the records from your Data Extension:
SELECT
SubscriberKey AS [Subscriber Key],
EmailAddress AS [Email Address],
'Active' AS [Status]
FROM
publistDE
Create a Data Extension Extract Activity to export the contents of your results DE
Create a File Transfer Activity to move the extracted data to the Enhanced FTP
Create an Import File Activity to import the file in the Enhanced FTP to your Publication List
Save and Run Once the Automation