How to add multiple cubes in a collection?
The script fails at two steps:

  bpy.context.scene.collection.children.link(collection) #add new coll to the scene


is done inside of the loop, so it fails the second time.

  cube.remove(cube["cube"], True)


does not exist: no remove method in cube.

That's why it stops before moving the second object to the new collection.

So this works:

import bpy

collection = bpy.data.collections.new(name="COLLECTION GOOD") #create new coll in data

bpy.context.scene.collection.children.link(collection) #add new coll to the scene

for i in range(0,2):
  bpy.ops.mesh.primitive_cube_add(location=(i, i, i))
  bpy.context.active_object.name = 'cube'
  cube = bpy.context.object

  obj_old_coll = cube.users_collection #list of all collection the obj is in
  collection.objects.link(cube) #link obj to scene

  #cube.remove(cube["cube"], True)
  for ob in obj_old_coll: #unlink from all  precedent obj collections
     ob.objects.unlink(cube)


And you can simplify a bit:

import bpy

collection = bpy.data.collections.new(name="COLLECTION GOOD") #create new coll in data

bpy.context.scene.collection.children.link(collection) #add new coll to the scene

for i in range(0,2):
  bpy.ops.mesh.primitive_cube_add(location=(i, i, i))
  bpy.context.active_object.name = 'cube'
  cube = bpy.context.object

  for ob in cube.users_collection[:]: #unlink from all  precedent obj collections
     ob.objects.unlink(cube)

  collection.objects.link(cube) #link obj to scene