Probably because you're overwriting the same variable on each iteration of the loop.
Try storing the value on each item instead:
for (var i = 0; i < $scope.UserProduct.length; i++) {
var product = $scope.UserProduct[i];
var generalPrice = product.ec_shop_product_price;
var discountPrice = product.ec_shop_product_discount;
product.discountvalue = generalPrice - discountPrice;
}