How to return a value from a void function and use it inside the void loop?

void loop() {

  byte tweet=0;

  val = digitalRead(LED_BUILTIN);


  digitalWrite(LED_BUILTIN, tweet);
  Serial.println("---");
  Serial.println(val);
  Serial.println("---");

  ...

}

Since you don't call your print function anywhere in loop, no you're not going to get the value of tweet from that function here. Here you have another local variable in loop that just happens to have the same name, tweet, as the local variable in the print function. But the two have absolutely nothing to do with one another. So when you call that digitalWrite tweet will still be 0 and the led will always be off.

Now you might have this in loop:

tweet = print();

and that will call print and return the value of tweet from print and store it in the tweet variable in loop.

New programmers are often tempted to use lots of global variables, because they are easy to work with, especially when many functions are involved. However, use of non-const global variables should generally be avoided altogether!

That's good advise for bigger programs. But for most Arduino code it is safely ignored advise. Typically these projects are written by one or two people and are small enough to tell when you shadow a variable. Sure, it's better to avoid globals, but I wouldn't get too bent out of shape about getting rid of them all. They're not going to hurt most of the time.